From 71eb763e53b3a91b6661dcfef43a48a45105893e Mon Sep 17 00:00:00 2001 From: def Date: Sun, 26 Oct 2014 02:01:03 +0100 Subject: [PATCH] Fix: Don't autoswitch weapons on (dd)race(network) servers (fixes #57) --- src/game/client/components/controls.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index b25e8a0ee..74b55fc59 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -436,7 +436,12 @@ void CControls::OnRender() } } - if( g_Config.m_ClAutoswitchWeaponsOutOfAmmo && m_pClient->m_Snap.m_pLocalCharacter ) + CServerInfo Info; + GameClient()->Client()->GetServerInfo(&Info); + bool IsGameTypeRace = str_find_nocase(Info.m_aGameType, "race") || str_find_nocase(Info.m_aGameType, "fastcap"); + bool IsGameTypeDDRace = str_find_nocase(Info.m_aGameType, "ddrace") || str_find_nocase(Info.m_aGameType, "mkrace"); + + if( g_Config.m_ClAutoswitchWeaponsOutOfAmmo && !IsGameTypeRace && !IsGameTypeDDRace && m_pClient->m_Snap.m_pLocalCharacter ) { // Keep track of ammo count, we know weapon ammo only when we switch to that weapon, this is tracked on server and protocol does not track that m_AmmoCount[m_pClient->m_Snap.m_pLocalCharacter->m_Weapon%NUM_WEAPONS] = m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount;