summaryrefslogtreecommitdiffstats
path: root/src/entities/Vehicle.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-06-30 12:59:55 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-06-30 12:59:55 +0200
commite2bd3573b4d44b8f80197d8de98fcfc91e2229b8 (patch)
tree7e3436ed3945245fca67127d00e0ccfee6d31239 /src/entities/Vehicle.cpp
parentProcessCarUpdate (diff)
downloadre3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar.gz
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar.bz2
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar.lz
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar.xz
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.tar.zst
re3-e2bd3573b4d44b8f80197d8de98fcfc91e2229b8.zip
Diffstat (limited to 'src/entities/Vehicle.cpp')
-rw-r--r--src/entities/Vehicle.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/entities/Vehicle.cpp b/src/entities/Vehicle.cpp
index ced504a3..bcbaee32 100644
--- a/src/entities/Vehicle.cpp
+++ b/src/entities/Vehicle.cpp
@@ -4,6 +4,8 @@
#include "Pools.h"
#include "CarCtrl.h"
#include "ModelIndices.h"
+#include "DMAudio.h"
+#include "Radar.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@@ -12,8 +14,34 @@ bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
+void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+CVehicle::~CVehicle()
+{
+ m_nAlarmState = 0;
+ if (m_audioEntityId >= 0){
+ DMAudio.DestroyEntity(m_audioEntityId);
+ m_audioEntityId = -5;
+ }
+ CRadar::ClearBlipForEntity(BLIP_CAR, CPools::GetVehiclePool()->GetIndex(this));
+ for (int i = 0; i < m_nNumMaxPassengers; i++){
+ if (pPassengers[i])
+ pPassengers[i]->FlagToDestroyWhenNextProcessed();
+ }
+ if (m_pCarFire)
+ m_pCarFire->Extinguish();
+ CCarCtrl::UpdateCarCount(this, true);
+ if (bIsAmbulanceOnDuty){
+ CCarCtrl::NumAmbulancesOnDuty--;
+ bIsAmbulanceOnDuty = false;
+ }
+ if (bIsFiretruckOnDuty){
+ CCarCtrl::NumFiretrucksOnDuty--;
+ bIsFiretruckOnDuty = false;
+ }
+}
+
bool
CVehicle::IsLawEnforcementVehicle(void)
{
@@ -47,6 +75,28 @@ CVehicle::ChangeLawEnforcerState(bool enable)
}
void
+CVehicle::RemovePassenger(CPed *p)
+{
+ if (IsTrain()){
+ for (int i = 0; i < 8; i++){
+ if (pPassengers[i] == p) {
+ pPassengers[i] = nil;
+ m_nNumPassengers--;
+ return;
+ }
+ }
+ return;
+ }
+ for (int i = 0; i < m_nNumMaxPassengers; i++){
+ if (pPassengers[i] == p){
+ pPassengers[i] = nil;
+ m_nNumPassengers--;
+ return;
+ }
+ }
+}
+
+void
CVehicle::RemoveDriver(void)
{
m_status = STATUS_ABANDONED;