summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-19 13:26:21 +0200
committerGitHub <noreply@github.com>2020-05-19 13:26:21 +0200
commit6b0b984909fe7ff268e978938e65a91d9bfd7d8c (patch)
tree71bf0f31ca1922c89b7996effe6ca87ef4c3a749 /src/vehicles
parentHandlingMgr (diff)
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar.gz
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar.bz2
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar.lz
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar.xz
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.tar.zst
re3-6b0b984909fe7ff268e978938e65a91d9bfd7d8c.zip
Diffstat (limited to '')
-rw-r--r--src/vehicles/Vehicle.cpp15
-rw-r--r--src/vehicles/Vehicle.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index a7465a0d..c90370f6 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -1378,3 +1378,18 @@ CVehicle::GetVehicleAppearance(void)
return VEHICLE_APPEARANCE_HELI;
return VEHICLE_APPEARANCE_NONE;
}
+
+bool
+IsVehiclePointerValid(CVehicle* pVehicle)
+{
+ if (!pVehicle)
+ return false;
+ int index = CPools::GetVehiclePool()->GetJustIndex(pVehicle);
+#ifdef FIX_BUGS
+ if (index < 0 || index >= NUMVEHICLES)
+#else
+ if (index < 0 || index > NUMVEHICLES)
+#endif
+ return false;
+ return pVehicle->m_vehType == VEHICLE_TYPE_PLANE || pVehicle->m_entryInfoList.first;
+}
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 5ec20c43..c2cfa5e4 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -314,3 +314,4 @@ public:
};
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);
+bool IsVehiclePointerValid(CVehicle* pVehicle);