diff --git a/Engine/source/console/simDictionary.cpp b/Engine/source/console/simDictionary.cpp index b733d9fcc..4f5aac411 100644 --- a/Engine/source/console/simDictionary.cpp +++ b/Engine/source/console/simDictionary.cpp @@ -45,13 +45,13 @@ SimNameDictionary::~SimNameDictionary() void SimNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; - SimObject* checkForDup = find(obj->objectName); + SimObject* checkForDup = find(obj->getName()); if (checkForDup) - Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->objectName); + Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->getName()); Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY @@ -64,7 +64,7 @@ void SimNameDictionary::insert(SimObject* obj) dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize); } - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -86,7 +86,7 @@ void SimNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -118,7 +118,7 @@ SimObject* SimNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -139,12 +139,12 @@ SimObject* SimNameDictionary::find(StringTableEntry name) void SimNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) @@ -190,12 +190,12 @@ SimManagerNameDictionary::~SimManagerNameDictionary() void SimManagerNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextManagerNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -217,7 +217,7 @@ void SimManagerNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextManagerNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextManagerNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -247,7 +247,7 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -267,13 +267,13 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) void SimManagerNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; #ifndef USE_NEW_SIMDICTIONARY Mutex::lockMutex(mutex); - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index ef688228f..c4b6848c9 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -71,7 +71,7 @@ namespace Sim SimObject::SimObject() { - objectName = NULL; + mObjectName = NULL; mOriginalName = NULL; mInternalName = NULL; nextNameObject = nullptr; @@ -128,10 +128,10 @@ SimObject::~SimObject() AssertFatal(nextNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from dictionary: name %s, id %i", - objectName, mId)); + mObjectName, mId)); AssertFatal(nextManagerNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i", - objectName,mId)); + mObjectName,mId)); AssertFatal(mFlags.test(Added) == 0, "SimObject::object " "missing call to SimObject::onRemove"); } @@ -149,7 +149,7 @@ void SimObject::initPersistFields() { addGroup( "Ungrouped" ); - addProtectedField( "name", TypeName, Offset(objectName, SimObject), &setProtectedName, &defaultProtectedGetFn, + addProtectedField( "name", TypeName, Offset(mObjectName, SimObject), &setProtectedName, &defaultProtectedGetFn, "Optional global name of this object." ); endGroup( "Ungrouped" ); @@ -211,8 +211,8 @@ String SimObject::describeSelf() const if( mId != 0 ) desc = avar( "%s|id: %i", desc.c_str(), mId ); - if( objectName ) - desc = avar( "%s|name: %s", desc.c_str(), objectName ); + if(mObjectName) + desc = avar( "%s|name: %s", desc.c_str(), mObjectName); if( mInternalName ) desc = avar( "%s|internal: %s", desc.c_str(), mInternalName ); if( mNameSpace ) @@ -754,9 +754,9 @@ void SimObject::setId(SimObjectId newId) void SimObject::assignName(const char *name) { - if( objectName && !isNameChangeAllowed() ) + if(mObjectName && !isNameChangeAllowed() ) { - Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", objectName ); + Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", mObjectName); return; } @@ -781,7 +781,7 @@ void SimObject::assignName(const char *name) Sim::gNameDictionary->remove( this ); } - objectName = newName; + mObjectName = newName; if( mGroup ) mGroup->mNameDictionary.insert( this ); @@ -1373,7 +1373,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone) { is_temp_clone = temp_clone; - objectName = other.objectName; + mObjectName = other.mObjectName; mOriginalName = other.mOriginalName; nextNameObject = other.nextNameObject; nextManagerNameObject = other.nextManagerNameObject; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 2119ea6a9..585944df7 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -293,7 +293,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks }; // dictionary information stored on the object - StringTableEntry objectName; + StringTableEntry mObjectName; StringTableEntry mOriginalName; SimObject* nextNameObject; SimObject* nextManagerNameObject; @@ -358,7 +358,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks { static_cast(object)->setSuperClassNamespace(data); return false; }; static bool writeObjectName(void* obj, StringTableEntry pFieldName) - { SimObject* simObject = static_cast(obj); return simObject->objectName != NULL && simObject->objectName != StringTable->EmptyString(); } + { SimObject* simObject = static_cast(obj); return simObject->mObjectName != NULL && simObject->mObjectName != StringTable->EmptyString(); } static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName) { return static_cast(obj)->mCanSaveFieldDictionary == false; } static bool writeInternalName(void* obj, StringTableEntry pFieldName) @@ -761,7 +761,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks const char* getIdString() const { return mIdString; } /// Return the name of this object. - StringTableEntry getName() const { return objectName; } + StringTableEntry getName() const { return mObjectName; } /// Return the SimGroup that this object is contained in. Never NULL except for /// RootGroup and unregistered objects.