summaryrefslogtreecommitdiff
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-21 16:09:44 +0300
committerGitHub <noreply@github.com>2019-10-21 16:09:44 +0300
commit4844b3a3f8037b379654bb8109050d0adbc94ae7 (patch)
tree4366aac26c53bebd0f98bc121b5f04b5cd750fe3 /src/control/CarCtrl.cpp
parent0759dbc1e1acc34fbc2ded0a186ec8fa85530a30 (diff)
parent5b1ffb09124c7427b7efb421091179ddecc725c4 (diff)
Merge pull request #246 from Sergeanur/Pools
Some CPool and CPools funcs, restoring original logic of pool lookup loops
Diffstat (limited to 'src/control/CarCtrl.cpp')
-rw-r--r--src/control/CarCtrl.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index fd6d8057..cf77b5a4 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -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;