Browse Source

cleanups and safeties.
had a bunch of dupliated code injectors that are bypassed by the nature of AbstractClassRep::FIELD_SpecialtyArrayField
since those getSpecialFieldOut entries return a const char * from the stringtable, we *don't* want to try and kill those off, since that can lead to trying to delete deleted things from what was designed as a permanent record

AzaezelX 7 months ago
parent
commit
0e22488434
1 changed files with 5 additions and 53 deletions
  1. 5 53
      Engine/source/console/persistenceManager.cpp

+ 5 - 53
Engine/source/console/persistenceManager.cpp

@@ -1433,29 +1433,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
                   }
                   else
                   {
-                     // TODO: This should be wrapped in a helper method... probably.
-                     // Detect and collapse relative path information
-                     if (f->type == TypeFilename ||
-                        f->type == TypeStringFilename ||
-                        f->type == TypeImageFilename ||
-                        f->type == TypePrefabFilename ||
-                        f->type == TypeShapeFilename ||
-                        f->type == TypeSoundFilename)
-                     {
-                        char fnBuf[1024];
-                        Con::collapseScriptFilename(fnBuf, 1024, value);
-
-                        updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, fnBuf, true);
-                     }
-                     else if (f->type == TypeCommand || f->type == TypeString || f->type == TypeRealString)
-                     {
-                        char cmdBuf[1024];
-                        expandEscape(cmdBuf, value);
-
-                        updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, cmdBuf, true);
-                     }
-                     else
-                        updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, value, true);
+                     updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, value, true);
                   }
                }
             }
@@ -1520,33 +1498,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
                // value then add it to the ParsedObject's newLines                        
                if (mustUpdate)
                {
-                  // TODO: This should be wrapped in a helper method... probably.
-                  // Detect and collapse relative path information
-                  if (f->type == TypeFilename ||
-                     f->type == TypeStringFilename ||
-                     f->type == TypeImageFilename ||
-                     f->type == TypePrefabFilename ||
-                     f->type == TypeShapeFilename ||
-                     f->type == TypeSoundFilename)
-                  {
-                     char fnBuf[1024];
-                     Con::collapseScriptFilename(fnBuf, 1024, value);
-
-                     newLines.push_back(createNewProperty(f->pFieldname, fnBuf, f->elementCount > 1, j));
-                  }
-                  else if (f->type == TypeCommand)
-                  {
-                     char cmdBuf[1024];
-                     expandEscape(cmdBuf, value);
-
-                     newLines.push_back(createNewProperty(f->pFieldname, cmdBuf, f->elementCount > 1, j));
-                  }
-                  else if (f->flag.test(AbstractClassRep::FIELD_SpecialtyArrayField))
-                  {
-                     newLines.push_back(value);
-                  }
-                  else
-                     newLines.push_back(createNewProperty(f->pFieldname, value, f->elementCount > 1, j));
+                  newLines.push_back(String::String(value).c_str());
                }
 
                if (defaultValue)
@@ -1862,11 +1814,11 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
    // Clean up the newLines memory
    for (U32 i = 0; i < newLines.size(); i++)
    {
-      if (newLines[i])
-      {
+      if (!isEmptyLine(newLines[i]) && !StringTable->lookup(newLines[i]))
+      {//don't try killing empty lines or lines that are in the string table
          dFree(newLines[i]);
-         newLines[ i ] = NULL;
       }
+      newLines[ i ] = NULL;
    }
 
    newLines.clear();