This commit is contained in:
Christian Semmler 2024-01-28 16:59:41 -05:00
parent 5c7872cbc0
commit 01035dfa64
2 changed files with 16 additions and 11 deletions

View File

@ -86,4 +86,7 @@ class LegoWorldListCursor : public MxPtrListCursor<LegoWorld> {
// SYNTHETIC: LEGO1 0x10059be0 // SYNTHETIC: LEGO1 0x10059be0
// MxPtrList<LegoWorld>::`scalar deleting destructor' // MxPtrList<LegoWorld>::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1005b740
// MxList<LegoWorld *>::DeleteEntry
#endif // LEGOWORLDLIST_H #endif // LEGOWORLDLIST_H

View File

@ -612,7 +612,7 @@ void LegoOmni::DeleteWorld(LegoWorld* p_world)
if (m_worldList) { if (m_worldList) {
LegoWorldListCursor cursor(m_worldList); LegoWorldListCursor cursor(m_worldList);
while (cursor.Find(p_world)) { if (cursor.Find(p_world)) {
cursor.Detach(); cursor.Detach();
if (m_currentWorld == p_world) { if (m_currentWorld == p_world) {
@ -620,7 +620,6 @@ void LegoOmni::DeleteWorld(LegoWorld* p_world)
} }
delete p_world; delete p_world;
break;
} }
} }
} }
@ -629,19 +628,22 @@ void LegoOmni::DeleteWorld(LegoWorld* p_world)
void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId) void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId)
{ {
if (m_worldList) { if (m_worldList) {
LegoWorldListCursor cursor(m_worldList); LegoWorldListCursor a(m_worldList);
LegoWorldListCursor cursor2(m_worldList); // not sure why there are 2 cursors used. LegoWorldListCursor b(m_worldList);
LegoWorld* world; LegoWorld* world;
while (cursor.Next(world)) { a.Head();
{ while (a.Current(world)) {
if ((p_objectId == -1 || world->GetEntityId() == p_objectId) && b = a;
(!p_atom.GetInternal() || world->GetAtom() == p_atom)) { b.Next();
cursor.Detach();
delete world; if ((p_objectId == -1 || world->GetEntityId() == p_objectId) &&
} (!p_atom.GetInternal() || world->GetAtom() == p_atom)) {
a.Detach();
delete world;
} }
a = b;
} }
} }
} }