mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Fix physics change by weak hook fix (fixes #5769)
This commit is contained in:
parent
098cb2b0f2
commit
cedc315a70
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void Reset() override;
|
||||
void Destroy() override;
|
||||
void PreTick() override;
|
||||
void PreTick();
|
||||
void Tick() override;
|
||||
void TickDeferred() override;
|
||||
void TickPaused() override;
|
||||
|
|
|
@ -86,13 +86,6 @@ public: // TODO: Maybe make protected
|
|||
*/
|
||||
virtual void Reset() {}
|
||||
|
||||
/*
|
||||
Function: PreTick
|
||||
Called to progress the entity before the next tick.
|
||||
Can be used to prepare variables for all clients before the next tick is executed.
|
||||
*/
|
||||
virtual void PreTick() {}
|
||||
|
||||
/*
|
||||
Function: Tick
|
||||
Called to progress the entity to the next tick. Updates
|
||||
|
|
|
@ -267,25 +267,31 @@ void CGameWorld::Tick()
|
|||
{
|
||||
if(GameServer()->m_pController->IsForceBalanced())
|
||||
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, "Teams have been balanced");
|
||||
|
||||
// update all objects
|
||||
if(g_Config.m_SvNoWeakHookAndBounce)
|
||||
for(int i = 0; i < NUM_ENTTYPES; i++)
|
||||
{
|
||||
for(auto *pEnt : m_apFirstEntityTypes)
|
||||
// It's important to call PreTick() and Tick() after each other.
|
||||
// If we call PreTick() before, and Tick() after other entities have been processed, it causes physics changes such as a stronger shotgun or grenade.
|
||||
if(g_Config.m_SvNoWeakHookAndBounce && i == ENTTYPE_CHARACTER)
|
||||
{
|
||||
auto *pEnt = m_apFirstEntityTypes[i];
|
||||
for(; pEnt;)
|
||||
{
|
||||
m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
|
||||
pEnt->PreTick();
|
||||
((CCharacter *)pEnt)->PreTick();
|
||||
pEnt = m_pNextTraverseEntity;
|
||||
}
|
||||
}
|
||||
|
||||
for(auto *pEnt : m_apFirstEntityTypes)
|
||||
auto *pEnt = m_apFirstEntityTypes[i];
|
||||
for(; pEnt;)
|
||||
{
|
||||
m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
|
||||
pEnt->Tick();
|
||||
pEnt = m_pNextTraverseEntity;
|
||||
}
|
||||
}
|
||||
|
||||
for(auto *pEnt : m_apFirstEntityTypes)
|
||||
for(; pEnt;)
|
||||
|
|
Loading…
Reference in a new issue