mirror of
https://github.com/halpz/re3.git
synced 2025-06-28 15:36:24 +00:00
Some CPool and CPools funcs, restoring original logic of pool lookup loops
This commit is contained in:
@ -123,8 +123,7 @@ void CBridge::FindBridgeEntities()
|
||||
pLiftRoad = nil;
|
||||
pLiftPart = nil;
|
||||
|
||||
for (int i = 1; i < CPools::GetBuildingPool()->GetSize(); ++i)
|
||||
{
|
||||
for (int i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--) {
|
||||
CBuilding* entry = CPools::GetBuildingPool()->GetSlot(i);
|
||||
if (entry)
|
||||
{
|
||||
|
@ -588,7 +588,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
|
||||
CVector2D forward = pVehicle->GetMoveSpeed() / flatSpeed;
|
||||
float projection = flatSpeed * 45 + 20;
|
||||
int i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CVehicle* vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!vehicle)
|
||||
continue;
|
||||
|
@ -648,8 +648,7 @@ CCarCtrl::AddToCarArray(int32 id, int32 vehclass)
|
||||
void
|
||||
CCarCtrl::RemoveDistantCars()
|
||||
{
|
||||
uint32 i = CPools::GetVehiclePool()->GetSize();
|
||||
while (--i){
|
||||
for (int i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!pVehicle)
|
||||
continue;
|
||||
@ -733,8 +732,7 @@ int32
|
||||
CCarCtrl::CountCarsOfType(int32 mi)
|
||||
{
|
||||
int32 total = 0;
|
||||
uint32 i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--){
|
||||
for (int i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!pVehicle)
|
||||
continue;
|
||||
|
@ -151,8 +151,8 @@ CPhoneInfo::Initialise(void)
|
||||
pickedUpPhone = nil;
|
||||
m_nMax = 0;
|
||||
m_nNum = 0;
|
||||
for (int v5 = pool->GetSize() - 1; v5 >= 0; v5--) {
|
||||
CBuilding *building = pool->GetSlot(v5);
|
||||
for (int i = pool->GetSize() - 1; i >= 0; i--) {
|
||||
CBuilding *building = pool->GetSlot(i);
|
||||
if (building) {
|
||||
if (building->m_modelIndex == MI_PHONEBOOTH1) {
|
||||
CPhone *maxPhone = &m_aPhones[m_nMax];
|
||||
|
@ -296,7 +296,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||
m_pObject->UpdateRwFrame();
|
||||
|
||||
bool touched = false;
|
||||
for (int32 i = CPools::GetVehiclePool()->GetSize(); i > 0; i--) { // TODO: check if i > 0 is not a R* mistake
|
||||
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
||||
touched = true;
|
||||
@ -323,7 +323,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||
if (CTimer::GetTimeInMilliseconds() > m_nTimer)
|
||||
explode = true;
|
||||
else {// added else here since vehicle lookup is useless
|
||||
for (int32 i = CPools::GetVehiclePool()->GetSize(); i > 0; i--) { // TODO: check if i > 0 is not a R* mistake
|
||||
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
||||
explode = true;
|
||||
|
@ -1156,7 +1156,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted); /* Nice memory leak */
|
||||
CWorld::Players[0] = PlayerInfo;
|
||||
int i = CPools::GetPedPool()->GetSize();
|
||||
while (i--){
|
||||
while (--i >= 0) {
|
||||
CPed* ped = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!ped)
|
||||
continue;
|
||||
@ -1174,7 +1174,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
ped->AddWeaponModel(ped->m_wepModelID);
|
||||
}
|
||||
i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--){
|
||||
while (--i >= 0) {
|
||||
CVehicle* vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!vehicle)
|
||||
continue;
|
||||
@ -1233,7 +1233,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
}
|
||||
PrintElementsInPtrList();
|
||||
i = CPools::GetObjectPool()->GetSize();
|
||||
while (i--){
|
||||
while (--i >= 0) {
|
||||
CObject* object = CPools::GetObjectPool()->GetSlot(i);
|
||||
if (!object)
|
||||
continue;
|
||||
@ -1248,7 +1248,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
object->GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame(object->m_rwObject)), false);
|
||||
}
|
||||
i = CPools::GetDummyPool()->GetSize();
|
||||
while (i--){
|
||||
while (--i >= 0) {
|
||||
CDummy* dummy = CPools::GetDummyPool()->GetSlot(i);
|
||||
if (!dummy)
|
||||
continue;
|
||||
@ -1294,7 +1294,7 @@ WRAPPER void CReplay::EmptyPedsAndVehiclePools(void) { EAXJMP(0x5970E0); }
|
||||
void CReplay::EmptyPedsAndVehiclePools(void)
|
||||
{
|
||||
int i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!v)
|
||||
continue;
|
||||
@ -1302,7 +1302,7 @@ void CReplay::EmptyPedsAndVehiclePools(void)
|
||||
delete v;
|
||||
}
|
||||
i = CPools::GetPedPool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!p)
|
||||
continue;
|
||||
@ -1319,7 +1319,7 @@ void CReplay::EmptyAllPools(void)
|
||||
{
|
||||
EmptyPedsAndVehiclePools();
|
||||
int i = CPools::GetObjectPool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CObject* o = CPools::GetObjectPool()->GetSlot(i);
|
||||
if (!o)
|
||||
continue;
|
||||
@ -1327,7 +1327,7 @@ void CReplay::EmptyAllPools(void)
|
||||
delete o;
|
||||
}
|
||||
i = CPools::GetDummyPool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CDummy* d = CPools::GetDummyPool()->GetSlot(i);
|
||||
if (!d)
|
||||
continue;
|
||||
@ -1343,14 +1343,14 @@ WRAPPER void CReplay::MarkEverythingAsNew(void) { EAXJMP(0x597280); }
|
||||
void CReplay::MarkEverythingAsNew(void)
|
||||
{
|
||||
int i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!v)
|
||||
continue;
|
||||
v->bHasAlreadyBeenRecorded = false;
|
||||
}
|
||||
i = CPools::GetPedPool()->GetSize();
|
||||
while (i--) {
|
||||
while (--i >= 0) {
|
||||
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!p)
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user