summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
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/peds/Ped.cpp
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 'src/peds/Ped.cpp')
-rw-r--r--src/peds/Ped.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index e25e592e..91dafbc2 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -18599,4 +18599,29 @@ CPed::AddInCarAnims(CVehicle* car, bool isDriver)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), group, anim, 100.0f);
StopNonPartialAnims();
-} \ No newline at end of file
+}
+
+bool
+IsPedPointerValid_NotInWorld(CPed* pPed)
+{
+ if (!pPed)
+ return false;
+ int index = CPools::GetPedPool()->GetJustIndex(pPed);
+#ifdef FIX_BUGS
+ if (index < 0 || index >= NUMPEDS)
+#else
+ if (index < 0 || index > NUMPEDS)
+#endif
+ return false;
+ return true;
+}
+
+bool
+IsPedPointerValid(CPed* pPed)
+{
+ if (!IsPedPointerValid_NotInWorld(pPed))
+ return false;
+ if (pPed->bInVehicle && pPed->m_pMyVehicle)
+ return IsEntityPointerValid(pPed->m_pMyVehicle);
+ return pPed->m_entryInfoList.first || pPed == FindPlayerPed();
+}