Some CPool and CPools funcs, restoring original logic of pool lookup loops

This commit is contained in:
Sergeanur 2019-10-17 00:53:25 +03:00
parent 2c81844c20
commit 5b1ffb0912
13 changed files with 147 additions and 51 deletions

View file

@ -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;