Browse Source

variable naming cleanup due to locals overriding in multiple places. objectname to mObjectName+ getName() refs in dictionary.

Azaezel 7 years ago
parent
commit
2e7d406860

+ 14 - 14
Engine/source/console/simDictionary.cpp

@@ -45,13 +45,13 @@ SimNameDictionary::~SimNameDictionary()
 
 
 void SimNameDictionary::insert(SimObject* obj)
 void SimNameDictionary::insert(SimObject* obj)
 {
 {
-   if (!obj || !obj->objectName)
+   if (!obj || !obj->getName())
       return;
       return;
 
 
-   SimObject* checkForDup = find(obj->objectName);
+   SimObject* checkForDup = find(obj->getName());
 
 
    if (checkForDup)
    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);
    Mutex::lockMutex(mutex);
 #ifndef USE_NEW_SIMDICTIONARY
 #ifndef USE_NEW_SIMDICTIONARY
@@ -64,7 +64,7 @@ void SimNameDictionary::insert(SimObject* obj)
       dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize);
       dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize);
    }
    }
 
 
-   S32 idx = HashPointer(obj->objectName) % hashTableSize;
+   S32 idx = HashPointer(obj->getName()) % hashTableSize;
    obj->nextNameObject = hashTable[idx];
    obj->nextNameObject = hashTable[idx];
    hashTable[idx] = obj;
    hashTable[idx] = obj;
    hashEntryCount++;
    hashEntryCount++;
@@ -86,7 +86,7 @@ void SimNameDictionary::insert(SimObject* obj)
          {
          {
             SimObject* next = object->nextNameObject;
             SimObject* next = object->nextNameObject;
 
 
-            idx = HashPointer(object->objectName) % newHashTableSize;
+            idx = HashPointer(object->getName()) % newHashTableSize;
             object->nextNameObject = newHashTable[idx];
             object->nextNameObject = newHashTable[idx];
             newHashTable[idx] = object;
             newHashTable[idx] = object;
 
 
@@ -118,7 +118,7 @@ SimObject* SimNameDictionary::find(StringTableEntry name)
    SimObject *walk = hashTable[idx];
    SimObject *walk = hashTable[idx];
    while (walk)
    while (walk)
    {
    {
-      if (walk->objectName == name)
+      if (walk->getName() == name)
       {
       {
          Mutex::unlockMutex(mutex);
          Mutex::unlockMutex(mutex);
          return walk;
          return walk;
@@ -139,12 +139,12 @@ SimObject* SimNameDictionary::find(StringTableEntry name)
 
 
 void SimNameDictionary::remove(SimObject* obj)
 void SimNameDictionary::remove(SimObject* obj)
 {
 {
-   if (!obj || !obj->objectName)
+   if (!obj || !obj->getName())
       return;
       return;
 
 
    Mutex::lockMutex(mutex);
    Mutex::lockMutex(mutex);
 #ifndef USE_NEW_SIMDICTIONARY
 #ifndef USE_NEW_SIMDICTIONARY
-   SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize];
+   SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize];
    while (*walk)
    while (*walk)
    {
    {
       if (*walk == obj)
       if (*walk == obj)
@@ -190,12 +190,12 @@ SimManagerNameDictionary::~SimManagerNameDictionary()
 
 
 void SimManagerNameDictionary::insert(SimObject* obj)
 void SimManagerNameDictionary::insert(SimObject* obj)
 {
 {
-   if (!obj || !obj->objectName)
+   if (!obj || !obj->getName())
       return;
       return;
 
 
    Mutex::lockMutex(mutex);
    Mutex::lockMutex(mutex);
 #ifndef USE_NEW_SIMDICTIONARY
 #ifndef USE_NEW_SIMDICTIONARY
-   S32 idx = HashPointer(obj->objectName) % hashTableSize;
+   S32 idx = HashPointer(obj->getName()) % hashTableSize;
    obj->nextManagerNameObject = hashTable[idx];
    obj->nextManagerNameObject = hashTable[idx];
    hashTable[idx] = obj;
    hashTable[idx] = obj;
    hashEntryCount++;
    hashEntryCount++;
@@ -217,7 +217,7 @@ void SimManagerNameDictionary::insert(SimObject* obj)
          {
          {
             SimObject* next = object->nextManagerNameObject;
             SimObject* next = object->nextManagerNameObject;
 
 
-            idx = HashPointer(object->objectName) % newHashTableSize;
+            idx = HashPointer(object->getName()) % newHashTableSize;
             object->nextManagerNameObject = newHashTable[idx];
             object->nextManagerNameObject = newHashTable[idx];
             newHashTable[idx] = object;
             newHashTable[idx] = object;
 
 
@@ -247,7 +247,7 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name)
    SimObject *walk = hashTable[idx];
    SimObject *walk = hashTable[idx];
    while (walk)
    while (walk)
    {
    {
-      if (walk->objectName == name)
+      if (walk->getName() == name)
       {
       {
          Mutex::unlockMutex(mutex);
          Mutex::unlockMutex(mutex);
          return walk;
          return walk;
@@ -267,13 +267,13 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name)
 
 
 void SimManagerNameDictionary::remove(SimObject* obj)
 void SimManagerNameDictionary::remove(SimObject* obj)
 {
 {
-   if (!obj || !obj->objectName)
+   if (!obj || !obj->getName())
       return;
       return;
 
 
 #ifndef USE_NEW_SIMDICTIONARY
 #ifndef USE_NEW_SIMDICTIONARY
    Mutex::lockMutex(mutex);
    Mutex::lockMutex(mutex);
 
 
-   SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize];
+   SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize];
    while (*walk)
    while (*walk)
    {
    {
       if (*walk == obj)
       if (*walk == obj)

+ 10 - 10
Engine/source/console/simObject.cpp

@@ -71,7 +71,7 @@ namespace Sim
 
 
 SimObject::SimObject()
 SimObject::SimObject()
 {
 {
-   objectName            = NULL;
+   mObjectName = NULL;
    mOriginalName         = NULL;
    mOriginalName         = NULL;
    mInternalName         = NULL;
    mInternalName         = NULL;
    nextNameObject        = nullptr;
    nextNameObject        = nullptr;
@@ -128,10 +128,10 @@ SimObject::~SimObject()
 
 
    AssertFatal(nextNameObject == nullptr,avar(
    AssertFatal(nextNameObject == nullptr,avar(
       "SimObject::~SimObject:  Not removed from dictionary: name %s, id %i",
       "SimObject::~SimObject:  Not removed from dictionary: name %s, id %i",
-      objectName, mId));
+	   mObjectName, mId));
    AssertFatal(nextManagerNameObject == nullptr,avar(
    AssertFatal(nextManagerNameObject == nullptr,avar(
       "SimObject::~SimObject:  Not removed from manager dictionary: name %s, id %i",
       "SimObject::~SimObject:  Not removed from manager dictionary: name %s, id %i",
-      objectName,mId));
+	   mObjectName,mId));
    AssertFatal(mFlags.test(Added) == 0, "SimObject::object "
    AssertFatal(mFlags.test(Added) == 0, "SimObject::object "
       "missing call to SimObject::onRemove");
       "missing call to SimObject::onRemove");
 }
 }
@@ -149,7 +149,7 @@ void SimObject::initPersistFields()
 {
 {
    addGroup( "Ungrouped" );
    addGroup( "Ungrouped" );
 
 
-      addProtectedField( "name", TypeName, Offset(objectName, SimObject), &setProtectedName, &defaultProtectedGetFn, 
+      addProtectedField( "name", TypeName, Offset(mObjectName, SimObject), &setProtectedName, &defaultProtectedGetFn,
          "Optional global name of this object." );
          "Optional global name of this object." );
                   
                   
    endGroup( "Ungrouped" );
    endGroup( "Ungrouped" );
@@ -211,8 +211,8 @@ String SimObject::describeSelf() const
    
    
    if( mId != 0 )
    if( mId != 0 )
       desc = avar( "%s|id: %i", desc.c_str(), mId );
       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 )
    if( mInternalName )
       desc = avar( "%s|internal: %s", desc.c_str(), mInternalName );
       desc = avar( "%s|internal: %s", desc.c_str(), mInternalName );
    if( mNameSpace )
    if( mNameSpace )
@@ -754,9 +754,9 @@ void SimObject::setId(SimObjectId newId)
 
 
 void SimObject::assignName(const char *name)
 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;
       return;
    }
    }
    
    
@@ -781,7 +781,7 @@ void SimObject::assignName(const char *name)
       Sim::gNameDictionary->remove( this );
       Sim::gNameDictionary->remove( this );
    }
    }
       
       
-   objectName = newName;
+   mObjectName = newName;
    
    
    if( mGroup )
    if( mGroup )
       mGroup->mNameDictionary.insert( this );
       mGroup->mNameDictionary.insert( this );
@@ -1373,7 +1373,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone)
 {
 {
    is_temp_clone = temp_clone;
    is_temp_clone = temp_clone;
 
 
-   objectName = other.objectName;
+   mObjectName = other.mObjectName;
    mOriginalName = other.mOriginalName;
    mOriginalName = other.mOriginalName;
    nextNameObject = other.nextNameObject;
    nextNameObject = other.nextNameObject;
    nextManagerNameObject = other.nextManagerNameObject;
    nextManagerNameObject = other.nextManagerNameObject;

+ 3 - 3
Engine/source/console/simObject.h

@@ -293,7 +293,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
       };
       };
       
       
       // dictionary information stored on the object
       // dictionary information stored on the object
-      StringTableEntry objectName;
+      StringTableEntry mObjectName;
       StringTableEntry mOriginalName;
       StringTableEntry mOriginalName;
       SimObject*       nextNameObject;
       SimObject*       nextNameObject;
       SimObject*       nextManagerNameObject;
       SimObject*       nextManagerNameObject;
@@ -358,7 +358,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
          { static_cast<SimObject*>(object)->setSuperClassNamespace(data); return false; };
          { static_cast<SimObject*>(object)->setSuperClassNamespace(data); return false; };
 
 
             static bool writeObjectName(void* obj, StringTableEntry pFieldName)
             static bool writeObjectName(void* obj, StringTableEntry pFieldName)
-         { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->objectName != NULL && simObject->objectName != StringTable->EmptyString(); }
+         { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mObjectName != NULL && simObject->mObjectName != StringTable->EmptyString(); }
       static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName)  
       static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName)  
          { return static_cast<SimObject*>(obj)->mCanSaveFieldDictionary == false; }
          { return static_cast<SimObject*>(obj)->mCanSaveFieldDictionary == false; }
       static bool writeInternalName(void* obj, StringTableEntry pFieldName)          
       static bool writeInternalName(void* obj, StringTableEntry pFieldName)          
@@ -761,7 +761,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
       const char* getIdString() const { return mIdString; }
       const char* getIdString() const { return mIdString; }
                   
                   
       /// Return the name of this object.
       /// 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
       /// Return the SimGroup that this object is contained in.  Never NULL except for
       /// RootGroup and unregistered objects.
       /// RootGroup and unregistered objects.