From 26f7f32de225e7d6c1ae62cfd69d5616949a9beb 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..ef42e46d72a 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 (int i = 0; i < MAX_CLIENTS; i++) { - m_pNextTraverseEntity = pChar->m_pNextTypeEntity; - ((CCharacter *)pChar)->WeaponTick(); - pChar = m_pNextTraverseEntity; + CCharacter *pChar = GameServer()->m_apPlayers[i]->GetCharacter(); + pChar->WeaponTick(); } // update all objects