diff options
Diffstat (limited to '')
-rw-r--r-- | src/entities/Vehicle.cpp | 50 |
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; |