summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-10-12 21:24:58 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-10-12 21:24:58 +0200
commita1700eeaa429e84ac95637652fed2d5719118c6e (patch)
tree37b3028b5d30e0425a957662fed24bad1ff8ab40 /src/peds/Ped.cpp
parentscript 400-499 start (diff)
parentMerge pull request #237 from Nick007J/master (diff)
downloadre3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar.gz
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar.bz2
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar.lz
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar.xz
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.tar.zst
re3-a1700eeaa429e84ac95637652fed2d5719118c6e.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 44908f9a..2b5c89bf 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -6136,7 +6136,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.
@@ -9024,7 +9024,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) {
@@ -10486,7 +10486,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) {
@@ -10579,7 +10579,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) {
@@ -10818,7 +10818,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) {
@@ -10959,7 +10959,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;
@@ -11324,7 +11324,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (!veh)
return;
- if (veh->IsWrecked() || ped->DyingOrDead())
+ if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
return;
ped->bInVehicle = true;
@@ -14633,6 +14633,12 @@ CPed::SetRadioStation(void)
}
}
+bool
+CPed::IsNotInWreckedVehicle()
+{
+ return m_pMyVehicle != nil && !m_pMyVehicle->IsWrecked();
+}
+
class CPed_ : public CPed
{
public: