From 12d16ddc063bc442c9366aff189f67827aeb09af Mon Sep 17 00:00:00 2001 From: erorcun Date: Wed, 16 Dec 2020 23:28:25 +0300 Subject: Fixes and style changes --- src/core/EventList.cpp | 1 - src/core/World.cpp | 13 +++++-------- src/core/templates.h | 3 ++- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index b22ddcb2..fc345163 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -59,7 +59,6 @@ CEventList::Update(void) } } -// ok void CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent, CPed *criminal, int32 timeout) { diff --git a/src/core/World.cpp b/src/core/World.cpp index 84722fc5..a75d17eb 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -2025,7 +2025,8 @@ CWorld::Process(void) if (csObj->IsObject()) RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * CTimer::GetTimeStepNonClipped()); else { - csObj->bOffscreen = !csObj->GetIsOnScreen(); + if (!csObj->bOffscreen) + csObj->bOffscreen = !csObj->GetIsOnScreen(); RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * CTimer::GetTimeStep(), !csObj->bOffscreen); } } @@ -2040,17 +2041,13 @@ CWorld::Process(void) } else { for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CEntity *movingEnt = (CEntity *)node->item; -#ifdef SQUEEZE_PERFORMANCE - if (movingEnt->bRemoveFromWorld) { - RemoveEntityInsteadOfProcessingIt(movingEnt); - } else -#endif - if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && + if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { if (movingEnt->IsObject()) RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * CTimer::GetTimeStepNonClipped()); else { - movingEnt->bOffscreen = !movingEnt->GetIsOnScreen(); + if (!movingEnt->bOffscreen) + movingEnt->bOffscreen = !movingEnt->GetIsOnScreen(); RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * CTimer::GetTimeStep(), !movingEnt->bOffscreen); } } diff --git a/src/core/templates.h b/src/core/templates.h index bb89814e..43c8d8fc 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -129,12 +129,13 @@ public: } int GetJustIndex(T* entry) { int index = GetJustIndex_NoFreeAssert(entry); + assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required assert(!IsFreeSlot(index)); return index; } int GetJustIndex_NoFreeAssert(T* entry) { int index = ((U*)entry - m_entries); - assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required + // Please don't add unsafe assert here, because at least one func. use this to check if entity is ped or vehicle. return index; } int GetNoOfUsedSpaces(void) const { -- cgit v1.2.3