summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-08 17:48:44 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-08 17:48:44 +0200
commit75943a57b2b9aa5cce36b2c387418acce1fe1c24 (patch)
tree157b7dc0489adfa7f97a83555335bdfbbef2bf3d /src/control/CarCtrl.cpp
parentMerge branch 'master' into miami (diff)
downloadre3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar.gz
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar.bz2
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar.lz
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar.xz
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.tar.zst
re3-75943a57b2b9aa5cce36b2c387418acce1fe1c24.zip
Diffstat (limited to 'src/control/CarCtrl.cpp')
-rw-r--r--src/control/CarCtrl.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 2c5751a3..ed14c6a0 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -597,7 +597,8 @@ CCarCtrl::ChooseCarRating(CZoneInfo* pZoneInfo)
int32
CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
int32 model = -1;
- for (int i = 0; i < 10 && (model == -1 || !CStreaming::HasModelLoaded(model)); i++) {
+ int i;
+ for (i = 0; i < 10 && (model == -1 || !CStreaming::HasModelLoaded(model)); i++) {
int rnd = CGeneral::GetRandomNumberInRange(0, 1000);
if (rnd < pZone->copThreshold) {
@@ -606,14 +607,17 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
continue;
}
- for (int i = 0; i < NUM_GANG_CAR_CLASSES; i++) {
+ for (i = 0; i < NUM_GANG_CAR_CLASSES; i++) {
if (rnd < pZone->gangThreshold[i]) {
*pClass = i + FIRST_GANG_CAR_RATING;
model = ChooseGangCarModel(i);
- continue;
+ break;
}
}
+ if (i != NUM_GANG_CAR_CLASSES)
+ continue;
+
*pClass = ChooseCarRating(pZone);
model = ChooseCarModel(*pClass);
}