From a202751ada610740d1950a68e0c83d1afa144fd3 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/game/server/gameworld.cpp b/src/game/server/gameworld.cpp index 7a511c9ebd0..d68c73ed0a5 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,15 @@ 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 &pPlayer : GameServer()->m_apPlayers) { - m_pNextTraverseEntity = pChar->m_pNextTypeEntity; - ((CCharacter *)pChar)->WeaponTick(); - pChar = m_pNextTraverseEntity; + if(!pPlayer) + continue; + CCharacter *pChar = pPlayer->GetCharacter(); + if(pChar) + pChar->WeaponTick(); } // update all objects