summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-12 16:03:32 +0200
committerSergeanur <s.anureev@yandex.ua>2019-10-12 16:03:32 +0200
commit35add59b3402ed7e6acf723cd592917da4139917 (patch)
treeabe70afb50af647263ece9945599d7684bd7ee93 /src/peds/Ped.cpp
parentMerge pull request #232 from Nick007J/master (diff)
downloadre3-35add59b3402ed7e6acf723cd592917da4139917.tar
re3-35add59b3402ed7e6acf723cd592917da4139917.tar.gz
re3-35add59b3402ed7e6acf723cd592917da4139917.tar.bz2
re3-35add59b3402ed7e6acf723cd592917da4139917.tar.lz
re3-35add59b3402ed7e6acf723cd592917da4139917.tar.xz
re3-35add59b3402ed7e6acf723cd592917da4139917.tar.zst
re3-35add59b3402ed7e6acf723cd592917da4139917.zip
Diffstat (limited to 'src/peds/Ped.cpp')
-rw-r--r--src/peds/Ped.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 87a0829e..1ecb3037 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -6134,7 +6134,7 @@ CPed::EndFight(uint8 endType)
void
CPed::EnterCar(void)
{
- if (!m_pMyVehicle->IsWrecked() && m_fHealth > 0.0f) {
+ if (IsNotInWreckedVehicle() && m_fHealth > 0.0f) {
CVehicle *veh = (CVehicle*)m_pSeekTarget;
// Not used.
@@ -9022,7 +9022,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
if (animAssoc)
animAssoc->blendDelta = -1000.0f;
- if (veh->IsWrecked())
+ if (!ped->IsNotInWreckedVehicle())
return;
if (ped->m_nPedState != PED_ENTER_CAR && ped->m_nPedState != PED_CARJACK) {
@@ -10484,7 +10484,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
CAutomobile *veh = (CAutomobile*)(ped->m_pMyVehicle);
- if (veh->IsWrecked() || ped->DyingOrDead())
+ if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
return;
if (ped->m_nPedState == PED_CARJACK || ped->m_nPedState == PED_ENTER_CAR) {
@@ -10577,7 +10577,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
if (animAssoc)
animAssoc->blendDelta = -1000.0f;
- if (veh->IsWrecked())
+ if (!ped->IsNotInWreckedVehicle())
return;
if (ped->m_nPedState != PED_CARJACK && ped->m_nPedState != PED_ENTER_CAR) {
@@ -10816,7 +10816,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
if (animAssoc)
animAssoc->blendDelta = -1000.0f;
- if (veh->IsWrecked() || ped->DyingOrDead())
+ if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
return;
if (ped->m_nPedState != PED_CARJACK && ped->m_nPedState != PED_ENTER_CAR) {
@@ -10957,7 +10957,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
animAssoc->blendDelta = -1000.0f;
if (ped->m_nPedState == PED_CARJACK || ped->m_nPedState == PED_ENTER_CAR) {
- if (veh->IsWrecked())
+ if (!ped->IsNotInWreckedVehicle())
return;
bool isLow = veh->bLowVehicle;
@@ -11322,7 +11322,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (!veh)
return;
- if (veh->IsWrecked() || ped->DyingOrDead())
+ if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
return;
ped->bInVehicle = true;
@@ -14631,6 +14631,12 @@ CPed::SetRadioStation(void)
}
}
+bool
+CPed::IsNotInWreckedVehicle()
+{
+ return m_pMyVehicle != nil && !m_pMyVehicle->IsWrecked();
+}
+
class CPed_ : public CPed
{
public: