Parcourir la source

Fix: preload() method on datablocks should always set errorStr when returning false.

Otherwise it will dump the previous error message (content of the errorStr).
bank il y a 11 ans
Parent
commit
b2e6895554

+ 3 - 0
Engine/source/T3D/player.cpp

@@ -586,7 +586,10 @@ bool PlayerData::preload(bool server, String &errorStr)
             Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath());
             Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath());
 
 
             if (!fileRef)
             if (!fileRef)
+            {
+               errorStr = String::ToString("PlayerData: Mounted image %d loading failed, shape \"%s\" is not found.",i,mShapeFP[i].getPath());
                return false;
                return false;
+            }
 
 
             if(server)
             if(server)
                mCRCFP[i] = fileRef->getChecksum();
                mCRCFP[i] = fileRef->getChecksum();

+ 1 - 0
Engine/source/T3D/rigidShape.cpp

@@ -302,6 +302,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
    if (!collisionDetails.size() || collisionDetails[0] == -1)
    if (!collisionDetails.size() || collisionDetails[0] == -1)
    {
    {
       Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
       Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
+      errorStr = String::ToString("RigidShapeData: Couldn't load shape \"%s\"",shapeName);
       return false;
       return false;
    }
    }
 
 

+ 3 - 0
Engine/source/T3D/shapeBase.cpp

@@ -306,7 +306,10 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
          Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(mShape.getPath());
          Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(mShape.getPath());
 
 
          if (!fileRef)
          if (!fileRef)
+         {
+            errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",shapeName);
             return false;
             return false;
+         }
 
 
          if(server)
          if(server)
             mCRC = fileRef->getChecksum();
             mCRC = fileRef->getChecksum();

+ 3 - 0
Engine/source/T3D/shapeImage.cpp

@@ -462,7 +462,10 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
             Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(shape[i].getPath());
             Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(shape[i].getPath());
 
 
             if (!fileRef)
             if (!fileRef)
+            {
+               errorStr = String::ToString("ShapeBaseImageData: Couldn't load shape \"%s\"",name);
                return false;
                return false;
+            }
 
 
             if(server)
             if(server)
             {
             {

+ 1 - 0
Engine/source/T3D/vehicles/vehicle.cpp

@@ -218,6 +218,7 @@ bool VehicleData::preload(bool server, String &errorStr)
    if (!collisionDetails.size() || collisionDetails[0] == -1)
    if (!collisionDetails.size() || collisionDetails[0] == -1)
    {
    {
       Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
       Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
+      errorStr = String::ToString("VehicleData: Couldn't load shape \"%s\"",shapeName);
       return false;
       return false;
    }
    }