diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-19 00:49:09 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-19 00:49:09 +0200 |
commit | 6510b15704998b14b89fa453ba9d142f85c30dd5 (patch) | |
tree | e194a3641474f3a0818bb4ff2dd139f2c293e804 /src/peds | |
parent | fixes for braking and cloud rotation at high fps (diff) | |
download | re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.gz re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.bz2 re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.lz re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.xz re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.zst re3-6510b15704998b14b89fa453ba9d142f85c30dd5.zip |
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 27 | ||||
-rw-r--r-- | src/peds/Ped.h | 3 |
2 files changed, 29 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(); +} diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 0e80c378..1fa36b05 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -1018,3 +1018,6 @@ void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg); #ifndef PED_SKIN VALIDATE_SIZE(CPed, 0x53C); #endif + +bool IsPedPointerValid(CPed*); +bool IsPedPointerValid_NotInWorld(CPed*); |