From f3e9c82432a260fa88ed8bc1d4a7432fd4a4fdba Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 8 Dec 2020 07:52:03 +0200 Subject: Pool fixes from master --- src/control/Garages.cpp | 4 ++-- src/control/Phones.cpp | 2 +- src/control/Pickups.cpp | 4 ++-- src/control/Script5.cpp | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 93067079..a8a7a46b 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1466,7 +1466,7 @@ static bool DoINeedToRefreshPointer(CEntity * pDoor, bool bIsDummy, uint8 nIndex bool bNeedToFindDoorEntities = false; if (pDoor) { if (bIsDummy) { - if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex((CDummy*)pDoor))) + if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)pDoor))) return true; if (nIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)pDoor) & 0x7F)) bNeedToFindDoorEntities = true; @@ -1474,7 +1474,7 @@ static bool DoINeedToRefreshPointer(CEntity * pDoor, bool bIsDummy, uint8 nIndex return true; } else { - if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex((CObject*)pDoor))) + if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)pDoor))) return true; if (nIndex != (CPools::GetObjectPool()->GetIndex((CObject*)pDoor) & 0x7F)) bNeedToFindDoorEntities = true; diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index 7f8677ec..edbfe6c2 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -308,7 +308,7 @@ INITSAVEBUF // Convert entity pointer to building pool index while saving if (phone->m_pEntity) { - phone->m_pEntity = (CEntity*) (CPools::GetBuildingPool()->GetJustIndex((CBuilding*)phone->m_pEntity) + 1); + phone->m_pEntity = (CEntity*) (CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)phone->m_pEntity) + 1); } } VALIDATESAVEBUF(*size) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 1ff4f8f6..45659554 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1458,9 +1458,9 @@ INITSAVEBUF CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]); if (buf_pickup->m_eType != PICKUP_NONE) { if (buf_pickup->m_pObject != nil) - buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pObject) + 1); + buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(buf_pickup->m_pObject) + 1); if (buf_pickup->m_pExtraObject != nil) - buf_pickup->m_pExtraObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pExtraObject) + 1); + buf_pickup->m_pExtraObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(buf_pickup->m_pExtraObject) + 1); } } diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 7efebb73..1f47c9b9 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -1784,10 +1784,10 @@ INITSAVEBUF handle = 0; } else if (pBuilding->GetIsATreadable()) { type = 1; - handle = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pBuilding) + 1; + handle = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pBuilding) + 1; } else { type = 2; - handle = CPools::GetBuildingPool()->GetJustIndex(pBuilding) + 1; + handle = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert(pBuilding) + 1; } WriteSaveBuf(buf, type); WriteSaveBuf(buf, handle); @@ -1805,19 +1805,19 @@ INITSAVEBUF case ENTITY_TYPE_BUILDING: if (((CBuilding*)pEntity)->GetIsATreadable()) { type = 1; - handle = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pEntity) + 1; + handle = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pEntity) + 1; } else { type = 2; - handle = CPools::GetBuildingPool()->GetJustIndex((CBuilding*)pEntity) + 1; + handle = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)pEntity) + 1; } break; case ENTITY_TYPE_OBJECT: type = 3; - handle = CPools::GetObjectPool()->GetJustIndex((CObject*)pEntity) + 1; + handle = CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)pEntity) + 1; break; case ENTITY_TYPE_DUMMY: type = 4; - handle = CPools::GetDummyPool()->GetJustIndex((CDummy*)pEntity) + 1; + handle = CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)pEntity) + 1; default: break; } } -- cgit v1.2.3