MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / remove

Method remove

Engine/source/console/simDictionary.cpp:142–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void SimNameDictionary::remove(SimObject* obj)
143{
144 if (!obj || !obj->getName())
145 return;
146
147 Mutex::lockMutex(mutex);
148#ifndef USE_NEW_SIMDICTIONARY
149 SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize];
150 while (*walk)
151 {
152 if (*walk == obj)
153 {
154 *walk = obj->nextNameObject;
155 obj->nextNameObject = nullptr;
156 hashEntryCount--;
157
158 Mutex::unlockMutex(mutex);
159 return;
160 }
161 walk = &((*walk)->nextNameObject);
162 }
163#else
164 const char* name = obj->objectName;
165 if (root.find(name) != root.end())
166 root.erase(name);
167#endif
168 Mutex::unlockMutex(mutex);
169}
170
171//----------------------------------------------------------------------------
172

Callers

nothing calls this directly

Calls 6

HashPointerFunction · 0.85
getIdMethod · 0.65
getNameMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected