From 869e6a78892a82f0b4553ff8bca3700fe8f0667c Mon Sep 17 00:00:00 2001 From: Tater Date: Sun, 2 Jun 2024 17:08:51 -0500 Subject: [PATCH] Preserve client order of weapon physics --- src/game/server/gameworld.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/server/gameworld.cpp b/src/game/server/gameworld.cpp index 7a511c9ebd0..d0352b2c99c 100644 --- a/src/game/server/gameworld.cpp +++ b/src/game/server/gameworld.cpp @@ -6,6 +6,7 @@ #include "entity.h" #include "gamecontext.h" #include "gamecontroller.h" +#include "player.h" #include @@ -214,13 +215,12 @@ void CGameWorld::Tick() if(GameServer()->m_pController->IsForceBalanced()) GameServer()->SendChat(-1, TEAM_ALL, "Teams have been balanced"); - // This is placed here so that certain weapon physics can happen before the regular Charecter Tick() to preserve physics accuracy - auto *pChar = m_apFirstEntityTypes[ENTTYPE_CHARACTER]; - for(; pChar;) + // This is placed here so that certain weapon physics can happen before the regular Charecter Tick() to preserve physics accuracy. + // It is done in client order to preserve previous behavior. + for(auto &m_apPlayer : GameServer()->m_apPlayers) { - m_pNextTraverseEntity = pChar->m_pNextTypeEntity; - ((CCharacter *)pChar)->WeaponTick(); - pChar = m_pNextTraverseEntity; + CCharacter *pChar = m_apPlayer->GetCharacter(); + pChar->WeaponTick(); } // update all objects