From 19b21cafcd0e457155c71f339dbccb94aff72d83 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 17:53:38 +0200 Subject: CZoneInfo mostly done; not its dependencies --- src/control/CarCtrl.cpp | 1 + src/control/CarCtrl.h | 12 +++++++++--- src/control/Script.cpp | 12 +++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 702bd411..34a2abee 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -664,6 +664,7 @@ CCarCtrl::ChooseGangCarModel(int32 gang) void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { + assert(TotalNumOfCarsOfRating[vehclass] < MAX_CAR_MODELS_IN_ARRAY); CarArrays[vehclass][TotalNumOfCarsOfRating[vehclass]++] = id; } diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h index 89de0418..8f5b6ef8 100644 --- a/src/control/CarCtrl.h +++ b/src/control/CarCtrl.h @@ -12,7 +12,7 @@ class CZoneInfo; enum{ MAX_CARS_TO_KEEP = 2, - MAX_CAR_MODELS_IN_ARRAY = 256, + MAX_CAR_MODELS_IN_ARRAY = 25, }; #define LANE_WIDTH 5.0f @@ -34,9 +34,11 @@ public: TAXI, MOPED, MOTORBIKE, + LEISUREBOAT, WORKERBOAT, - TOTAL_CUSTOM_CLASSES, + + COPS, MAFIA, TRIAD, DIABLO, @@ -46,7 +48,11 @@ public: NINES, GANG8, GANG9, - COPS + COPSBOAT, + + NUM_CAR_CLASSES = MOTORBIKE+1, + NUM_BOAT_CLASSES = 2, + TOTAL_CUSTOM_CLASSES = NUM_CAR_CLASSES + NUM_BOAT_CLASSES }; static void SwitchVehicleToRealPhysics(CVehicle*); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 58222317..86fe412a 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3089,18 +3089,20 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_SET_ZONE_CAR_INFO: { char label[12]; + int16 gangDensities[NUM_GANGS]; + int i; + CTheScripts::ReadTextLabelFromScript(&m_nIp, label); m_nIp += KEY_LENGTH_IN_SCRIPT; - CollectParameters(&m_nIp, 16); + CollectParameters(&m_nIp, 12); int zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO); if (zone < 0) { debug("Couldn't find zone - %s\n", label); return 0; } - CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], - ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], 0, 0, - ScriptParams[9], ScriptParams[10], ScriptParams[11], ScriptParams[12], - ScriptParams[13], ScriptParams[14], ScriptParams[15]); + for(i = 0; i < NUM_GANGS; i++) + gangDensities[i] = ScriptParams[2+i]; + CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[11], gangDensities); return 0; } /* Not implemented. -- cgit v1.2.3