summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/CarCtrl.cpp')
-rw-r--r--src/control/CarCtrl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 627e608c..2c5751a3 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -653,13 +653,16 @@ CCarCtrl::RemoveFromLoadedVehicleArray(int mi, int32 rating)
while (LoadedCarsArray[rating][index] != -1) {
if (LoadedCarsArray[rating][index] == mi)
break;
+ index++;
}
+ assert(LoadedCarsArray[rating][index] == mi);
int32 freq = CarFreqArrays[rating][index];
if (index > 0)
freq -= CarFreqArrays[rating][index - 1];
while (LoadedCarsArray[rating][index + 1] != -1) {
LoadedCarsArray[rating][index] = LoadedCarsArray[rating][index + 1];
CarFreqArrays[rating][index] = CarFreqArrays[rating][index + 1] - freq;
+ index++;
}
--NumOfLoadedCarsOfRating[rating];
}