mirror of
https://github.com/halpz/re3.git
synced 2024-12-25 18:05:27 +00:00
pool stuff fix
This commit is contained in:
parent
17a939e38d
commit
406f646949
|
@ -308,7 +308,7 @@ INITSAVEBUF
|
||||||
|
|
||||||
// Convert entity pointer to building pool index while saving
|
// Convert entity pointer to building pool index while saving
|
||||||
if (phone->m_pEntity) {
|
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)
|
VALIDATESAVEBUF(*size)
|
||||||
|
|
|
@ -1458,9 +1458,9 @@ INITSAVEBUF
|
||||||
CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]);
|
CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]);
|
||||||
if (buf_pickup->m_eType != PICKUP_NONE) {
|
if (buf_pickup->m_eType != PICKUP_NONE) {
|
||||||
if (buf_pickup->m_pObject != nil)
|
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)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1784,10 +1784,10 @@ INITSAVEBUF
|
||||||
handle = 0;
|
handle = 0;
|
||||||
} else if (pBuilding->GetIsATreadable()) {
|
} else if (pBuilding->GetIsATreadable()) {
|
||||||
type = 1;
|
type = 1;
|
||||||
handle = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pBuilding) + 1;
|
handle = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pBuilding) + 1;
|
||||||
} else {
|
} else {
|
||||||
type = 2;
|
type = 2;
|
||||||
handle = CPools::GetBuildingPool()->GetJustIndex(pBuilding) + 1;
|
handle = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert(pBuilding) + 1;
|
||||||
}
|
}
|
||||||
WriteSaveBuf(buf, type);
|
WriteSaveBuf(buf, type);
|
||||||
WriteSaveBuf(buf, handle);
|
WriteSaveBuf(buf, handle);
|
||||||
|
@ -1805,19 +1805,19 @@ INITSAVEBUF
|
||||||
case ENTITY_TYPE_BUILDING:
|
case ENTITY_TYPE_BUILDING:
|
||||||
if (((CBuilding*)pEntity)->GetIsATreadable()) {
|
if (((CBuilding*)pEntity)->GetIsATreadable()) {
|
||||||
type = 1;
|
type = 1;
|
||||||
handle = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pEntity) + 1;
|
handle = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pEntity) + 1;
|
||||||
} else {
|
} else {
|
||||||
type = 2;
|
type = 2;
|
||||||
handle = CPools::GetBuildingPool()->GetJustIndex((CBuilding*)pEntity) + 1;
|
handle = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)pEntity) + 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENTITY_TYPE_OBJECT:
|
case ENTITY_TYPE_OBJECT:
|
||||||
type = 3;
|
type = 3;
|
||||||
handle = CPools::GetObjectPool()->GetJustIndex((CObject*)pEntity) + 1;
|
handle = CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)pEntity) + 1;
|
||||||
break;
|
break;
|
||||||
case ENTITY_TYPE_DUMMY:
|
case ENTITY_TYPE_DUMMY:
|
||||||
type = 4;
|
type = 4;
|
||||||
handle = CPools::GetDummyPool()->GetJustIndex((CDummy*)pEntity) + 1;
|
handle = CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)pEntity) + 1;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,14 @@ IsBuildingPointerValid(CBuilding* pBuilding)
|
||||||
if (!pBuilding)
|
if (!pBuilding)
|
||||||
return false;
|
return false;
|
||||||
if (pBuilding->GetIsATreadable()) {
|
if (pBuilding->GetIsATreadable()) {
|
||||||
int index = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pBuilding);
|
int index = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pBuilding);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
return index >= 0 && index < CPools::GetTreadablePool()->GetSize();
|
return index >= 0 && index < CPools::GetTreadablePool()->GetSize();
|
||||||
#else
|
#else
|
||||||
return index >= 0 && index <= CPools::GetTreadablePool()->GetSize();
|
return index >= 0 && index <= CPools::GetTreadablePool()->GetSize();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
int index = CPools::GetBuildingPool()->GetJustIndex(pBuilding);
|
int index = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert(pBuilding);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
return index >= 0 && index < CPools::GetBuildingPool()->GetSize();
|
return index >= 0 && index < CPools::GetBuildingPool()->GetSize();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -58,7 +58,7 @@ IsDummyPointerValid(CDummy* pDummy)
|
||||||
{
|
{
|
||||||
if (!pDummy)
|
if (!pDummy)
|
||||||
return false;
|
return false;
|
||||||
int index = CPools::GetDummyPool()->GetJustIndex(pDummy);
|
int index = CPools::GetDummyPool()->GetJustIndex_NoFreeAssert(pDummy);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if (index < 0 || index >= CPools::GetDummyPool()->GetSize())
|
if (index < 0 || index >= CPools::GetDummyPool()->GetSize())
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -527,7 +527,7 @@ IsObjectPointerValid(CObject* pObject)
|
||||||
{
|
{
|
||||||
if (!pObject)
|
if (!pObject)
|
||||||
return false;
|
return false;
|
||||||
int index = CPools::GetObjectPool()->GetJustIndex(pObject);
|
int index = CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(pObject);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if (index < 0 || index >= CPools::GetObjectPool()->GetSize())
|
if (index < 0 || index >= CPools::GetObjectPool()->GetSize())
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -7846,7 +7846,7 @@ IsPedPointerValid_NotInWorld(CPed* pPed)
|
||||||
{
|
{
|
||||||
if (!pPed)
|
if (!pPed)
|
||||||
return false;
|
return false;
|
||||||
int index = CPools::GetPedPool()->GetJustIndex(pPed);
|
int index = CPools::GetPedPool()->GetJustIndex_NoFreeAssert(pPed);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if (index < 0 || index >= NUMPEDS)
|
if (index < 0 || index >= NUMPEDS)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ INITSAVEBUF
|
||||||
|
|
||||||
for (int32 j = 0; j < 6; j++) {
|
for (int32 j = 0; j < 6; j++) {
|
||||||
if (pPath->m_pObjects[j] != nil)
|
if (pPath->m_pObjects[j] != nil)
|
||||||
pPath->m_pObjects[j] = (CObject*)(CPools::GetObjectPool()->GetJustIndex(pPath->m_pObjects[j]) + 1);
|
pPath->m_pObjects[j] = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(pPath->m_pObjects[j]) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32 j = 0; j < aArray[i].m_numNodes; j++) {
|
for (int32 j = 0; j < aArray[i].m_numNodes; j++) {
|
||||||
|
|
|
@ -629,11 +629,11 @@ void CCranes::Save(uint8* buf, uint32* size)
|
||||||
for (int i = 0; i < NUM_CRANES; i++) {
|
for (int i = 0; i < NUM_CRANES; i++) {
|
||||||
CCrane *pCrane = WriteSaveBuf(buf, aCranes[i]);
|
CCrane *pCrane = WriteSaveBuf(buf, aCranes[i]);
|
||||||
if (pCrane->m_pCraneEntity != nil)
|
if (pCrane->m_pCraneEntity != nil)
|
||||||
pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex(pCrane->m_pCraneEntity) + 1);
|
pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert(pCrane->m_pCraneEntity) + 1);
|
||||||
if (pCrane->m_pHook != nil)
|
if (pCrane->m_pHook != nil)
|
||||||
pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex(pCrane->m_pHook) + 1);
|
pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(pCrane->m_pHook) + 1);
|
||||||
if (pCrane->m_pVehiclePickedUp != nil)
|
if (pCrane->m_pVehiclePickedUp != nil)
|
||||||
pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex(pCrane->m_pVehiclePickedUp) + 1);
|
pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex_NoFreeAssert(pCrane->m_pVehiclePickedUp) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALIDATESAVEBUF(*size);
|
VALIDATESAVEBUF(*size);
|
||||||
|
|
|
@ -2492,7 +2492,7 @@ IsVehiclePointerValid(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
if (!pVehicle)
|
if (!pVehicle)
|
||||||
return false;
|
return false;
|
||||||
int index = CPools::GetVehiclePool()->GetJustIndex(pVehicle);
|
int index = CPools::GetVehiclePool()->GetJustIndex_NoFreeAssert(pVehicle);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if (index < 0 || index >= NUMVEHICLES)
|
if (index < 0 || index >= NUMVEHICLES)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue