mirror of
https://github.com/halpz/re3.git
synced 2025-07-13 19:18:12 +00:00
garages revision + some fixes
This commit is contained in:
@ -1164,8 +1164,8 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecStartPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecStartPos.y), NUMSECTORS_Y - 1);
|
||||
#else
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecSectorPos.x), NUMSECTORS_X);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecSectorPos.y), NUMSECTORS_Y);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecStartPos.x), NUMSECTORS_X);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecStartPos.y), NUMSECTORS_Y);
|
||||
#endif
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
@ -1781,10 +1781,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) {
|
||||
@ -1796,6 +1798,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();
|
||||
|
@ -123,13 +123,19 @@ public:
|
||||
return m_flags[handle>>8].u == (handle & 0xFF) ?
|
||||
(T*)&m_entries[handle >> 8] : nil;
|
||||
}
|
||||
int GetIndex(T *entry){
|
||||
int i = GetJustIndex(entry);
|
||||
return m_flags[i].u + (i<<8);
|
||||
int GetIndex(T* 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 GetJustIndex(T* entry) {
|
||||
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;
|
||||
|
Reference in New Issue
Block a user