diff options
author | aap <aap@papnet.eu> | 2020-12-01 11:25:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 11:25:02 +0100 |
commit | 56c471d02e1c704202f809de7f3d179c98ae121f (patch) | |
tree | a1886f8b54f498c02c9ffecb9f1541f65ecedfae /src/core | |
parent | cam stuff (diff) | |
parent | Merge remote-tracking branch 'upstream/master' (diff) | |
download | re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar.gz re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar.bz2 re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar.lz re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar.xz re3-56c471d02e1c704202f809de7f3d179c98ae121f.tar.zst re3-56c471d02e1c704202f809de7f3d179c98ae121f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/World.cpp | 8 | ||||
-rw-r--r-- | src/core/templates.h | 12 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/core/World.cpp b/src/core/World.cpp index 62d8d002..844a4fb7 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1738,10 +1738,12 @@ CWorld::ShutDown(void) CWorld::Remove(pEntity); delete pEntity; } +#ifndef FIX_BUGS pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); +#endif } for(int32 i = 0; i < 4; i++) { for(CPtrNode *pNode = GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) { @@ -1753,6 +1755,12 @@ CWorld::ShutDown(void) } for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); +#ifdef FIX_BUGS + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); +#endif if(pSector->m_lists[ENTITYLIST_BUILDINGS].first) { sprintf(gString, "Building list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); diff --git a/src/core/templates.h b/src/core/templates.h index 86239664..166f865c 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -124,12 +124,18 @@ public: (T*)&m_entries[handle >> 8] : nil; } int GetIndex(T *entry){ - int i = GetJustIndex(entry); + int i = GetJustIndex_NoFreeAssert(entry); return m_flags[i].u + (i<<8); } int GetJustIndex(T *entry){ - // TODO: the cast is unsafe - return (int)((U*)entry - m_entries); + int index = GetJustIndex_NoFreeAssert(entry); + assert(!IsFreeSlot(index)); + return index; + } + int GetJustIndex_NoFreeAssert(T* entry){ + int index = ((U*)entry - m_entries); + assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required + return index; } int GetNoOfUsedSpaces(void) const{ int i; |