summaryrefslogtreecommitdiffstats
path: root/src/control/Script.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-11-19 23:15:45 +0100
committereray orçunus <erayorcunus@gmail.com>2019-11-20 22:05:10 +0100
commitbd68b56b5d9ed6637973b57f742c17727ca214ac (patch)
tree137c86403af35f742ebdff48706b520e4134dc5f /src/control/Script.cpp
parentMerge branch 'master' of git://github.com/GTAmodding/re3 into erorcun (diff)
downloadre3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar.gz
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar.bz2
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar.lz
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar.xz
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.tar.zst
re3-bd68b56b5d9ed6637973b57f742c17727ca214ac.zip
Diffstat (limited to '')
-rw-r--r--src/control/Script.cpp48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 62f92620..2e3d287a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -2307,17 +2307,23 @@ int8 CRunningScript::ProcessCommandsFrom200To299(int32 command)
assert(pCurrent); // GetIndex(0) doesn't look good
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){
- CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
- if (pOld){
- CCarCtrl::RemoveFromInterestingVehicleList(pOld);
- if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){
- pOld->VehicleCreatedBy = RANDOM_VEHICLE;
- pOld->bIsLocked = false;
- CCarCtrl::NumRandomCars++;
- CCarCtrl::NumMissionCars--;
- CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
+#ifdef FIX_BUGS
+ if (CTheScripts::StoreVehicleIndex != -1)
+#endif
+ {
+ CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
+ if (pOld){
+ CCarCtrl::RemoveFromInterestingVehicleList(pOld);
+ if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){
+ pOld->VehicleCreatedBy = RANDOM_VEHICLE;
+ pOld->bIsLocked = false;
+ CCarCtrl::NumRandomCars++;
+ CCarCtrl::NumMissionCars--;
+ CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
+ }
}
}
+
CTheScripts::StoreVehicleIndex = handle;
switch (pCurrent->VehicleCreatedBy){
case RANDOM_VEHICLE:
@@ -2357,17 +2363,23 @@ int8 CRunningScript::ProcessCommandsFrom200To299(int32 command)
assert(pCurrent); // Here pCurrent shouldn't be NULL anyway
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) {
- CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
- if (pOld) {
- CCarCtrl::RemoveFromInterestingVehicleList(pOld);
- if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom) {
- pOld->VehicleCreatedBy = RANDOM_VEHICLE;
- pOld->bIsLocked = false;
- CCarCtrl::NumRandomCars++;
- CCarCtrl::NumMissionCars--;
- CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
+#ifdef FIX_BUGS
+ if (CTheScripts::StoreVehicleIndex != -1)
+#endif
+ {
+ CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
+ if (pOld){
+ CCarCtrl::RemoveFromInterestingVehicleList(pOld);
+ if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){
+ pOld->VehicleCreatedBy = RANDOM_VEHICLE;
+ pOld->bIsLocked = false;
+ CCarCtrl::NumRandomCars++;
+ CCarCtrl::NumMissionCars--;
+ CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
+ }
}
}
+
CTheScripts::StoreVehicleIndex = handle;
switch (pCurrent->VehicleCreatedBy) {
case RANDOM_VEHICLE: