Forráskód Böngészése

Scene, Connection: use hash32 type for checksum

1vanK 3 éve
szülő
commit
028c676593

+ 5 - 5
Source/Urho3D/AngelScript/Generated_Members.h

@@ -7250,8 +7250,8 @@ template <class T> void RegisterMembers_PackageDownload(asIScriptEngine* engine,
     // unsigned PackageDownload::totalFragments_
     engine->RegisterObjectProperty(className, "uint totalFragments", offsetof(T, totalFragments_));
 
-    // unsigned PackageDownload::checksum_
-    engine->RegisterObjectProperty(className, "uint checksum", offsetof(T, checksum_));
+    // hash32 PackageDownload::checksum_
+    engine->RegisterObjectProperty(className, "hash32 checksum", offsetof(T, checksum_));
 
     // bool PackageDownload::initiated_
     engine->RegisterObjectProperty(className, "bool initiated", offsetof(T, initiated_));
@@ -18180,9 +18180,9 @@ template <class T> void RegisterMembers_Scene(asIScriptEngine* engine, const cha
     engine->RegisterObjectMethod(className, "float GetAsyncProgress() const", AS_METHODPR(T, GetAsyncProgress, () const, float), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "float get_asyncProgress() const", AS_METHODPR(T, GetAsyncProgress, () const, float), AS_CALL_THISCALL);
 
-    // unsigned Scene::GetChecksum() const
-    engine->RegisterObjectMethod(className, "uint GetChecksum() const", AS_METHODPR(T, GetChecksum, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_checksum() const", AS_METHODPR(T, GetChecksum, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 Scene::GetChecksum() const
+    engine->RegisterObjectMethod(className, "hash32 GetChecksum() const", AS_METHODPR(T, GetChecksum, () const, hash32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "hash32 get_checksum() const", AS_METHODPR(T, GetChecksum, () const, hash32), AS_CALL_THISCALL);
 
     // Component* Scene::GetComponent(unsigned id) const
     engine->RegisterObjectMethod(className, "Component@+ GetComponent(uint) const", AS_METHODPR(T, GetComponent, (unsigned) const, Component*), AS_CALL_THISCALL);

+ 3 - 3
Source/Urho3D/Network/Connection.cpp

@@ -975,7 +975,7 @@ void Connection::ProcessSceneLoaded(int msgID, MemoryBuffer& msg)
         return;
     }
 
-    unsigned checksum = msg.ReadUInt();
+    hash32 checksum = msg.ReadUInt();
 
     if (checksum != scene_->GetChecksum())
     {
@@ -1465,7 +1465,7 @@ bool Connection::RequestNeededPackages(unsigned numPackages, MemoryBuffer& msg)
     {
         String name = msg.ReadString();
         unsigned fileSize = msg.ReadUInt();
-        unsigned checksum = msg.ReadUInt();
+        hash32 checksum = msg.ReadUInt();
         String checksumString = ToStringHex(checksum);
         bool found = false;
 
@@ -1523,7 +1523,7 @@ bool Connection::RequestNeededPackages(unsigned numPackages, MemoryBuffer& msg)
     return true;
 }
 
-void Connection::RequestPackage(const String& name, unsigned fileSize, unsigned checksum)
+void Connection::RequestPackage(const String& name, unsigned fileSize, hash32 checksum)
 {
     StringHash nameHash(name);
     if (downloads_.Contains(nameHash))

+ 2 - 2
Source/Urho3D/Network/Connection.h

@@ -60,7 +60,7 @@ struct PackageDownload
     /// Total number of fragments.
     unsigned totalFragments_;
     /// Checksum.
-    unsigned checksum_;
+    hash32 checksum_;
     /// Download initiated flag.
     bool initiated_;
 };
@@ -289,7 +289,7 @@ private:
     /// Check a package list received from server and initiate package downloads as necessary. Return true on success, or false if failed to initialze downloads (cache dir not set).
     bool RequestNeededPackages(unsigned numPackages, MemoryBuffer& msg);
     /// Initiate a package download.
-    void RequestPackage(const String& name, unsigned fileSize, unsigned checksum);
+    void RequestPackage(const String& name, unsigned fileSize, hash32 checksum);
     /// Send an error reply for a package download.
     void SendPackageError(const String& name);
     /// Handle scene load failure on the server or client.

+ 2 - 2
Source/Urho3D/Scene/Scene.h

@@ -187,7 +187,7 @@ public:
 
     /// Return source file checksum.
     /// @property
-    unsigned GetChecksum() const { return checksum_; }
+    hash32 GetChecksum() const { return checksum_; }
 
     /// Return update time scale.
     /// @property
@@ -323,7 +323,7 @@ private:
     /// Next free local component ID.
     unsigned localComponentID_;
     /// Scene source file checksum.
-    mutable unsigned checksum_;
+    mutable hash32 checksum_;
     /// Maximum milliseconds per frame to spend on async scene loading.
     int asyncLoadingMs_;
     /// Scene update time scale.