about summary refs log tree commit diff
path: root/src/game/server/gamemodes/ctf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/server/gamemodes/ctf.cpp')
-rw-r--r--src/game/server/gamemodes/ctf.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/game/server/gamemodes/ctf.cpp b/src/game/server/gamemodes/ctf.cpp
index 92fc90c9..490067dd 100644
--- a/src/game/server/gamemodes/ctf.cpp
+++ b/src/game/server/gamemodes/ctf.cpp
@@ -78,6 +78,31 @@ bool CGameControllerCTF::CanBeMovedOnBalance(int ClientID)
 	return true;
 }
 
+void CGameControllerCTF::Snap(int SnappingClient)
+{
+	IGameController::Snap(SnappingClient);
+
+	CNetObj_GameData *pGameDataObj = (CNetObj_GameData *)Server()->SnapNewItem(NETOBJTYPE_GAMEDATA, 0, sizeof(CNetObj_GameData));
+	if(!pGameDataObj)
+		return;
+
+	pGameDataObj->m_TeamscoreRed = m_aTeamscore[TEAM_RED];
+	pGameDataObj->m_TeamscoreBlue = m_aTeamscore[TEAM_BLUE];
+
+	if(m_apFlags[TEAM_RED]->m_AtStand)
+		pGameDataObj->m_FlagCarrierRed = FLAG_ATSTAND;
+	else if(m_apFlags[TEAM_RED]->m_pCarryingCharacter && m_apFlags[TEAM_RED]->m_pCarryingCharacter->GetPlayer())
+		pGameDataObj->m_FlagCarrierRed = m_apFlags[TEAM_RED]->m_pCarryingCharacter->GetPlayer()->GetCID();
+	else
+		pGameDataObj->m_FlagCarrierRed = FLAG_TAKEN;
+	if(m_apFlags[TEAM_BLUE]->m_AtStand)
+		pGameDataObj->m_FlagCarrierBlue = FLAG_ATSTAND;
+	else if(m_apFlags[TEAM_BLUE]->m_pCarryingCharacter && m_apFlags[TEAM_BLUE]->m_pCarryingCharacter->GetPlayer())
+		pGameDataObj->m_FlagCarrierBlue = m_apFlags[TEAM_BLUE]->m_pCarryingCharacter->GetPlayer()->GetCID();
+	else
+		pGameDataObj->m_FlagCarrierBlue = FLAG_TAKEN;
+}
+
 void CGameControllerCTF::Tick()
 {
 	IGameController::Tick();