about summary refs log tree commit diff
path: root/src/game/server/player.cpp
diff options
context:
space:
mode:
authorMarius "Teelevision" Neugebauer <marius@teele.eu>2014-04-08 03:05:30 +0200
committerMarius "Teelevision" Neugebauer <marius@teele.eu>2014-04-08 03:05:30 +0200
commit8f8b35f3d24184796181c332f13473dbbfb157f1 (patch)
tree7e7e7b2a6bfb6e4462a1fe277a6489824beb6122 /src/game/server/player.cpp
parent2e3107802663087eadd711eb43b09605080730be (diff)
downloadzcatch-8f8b35f3d24184796181c332f13473dbbfb157f1.tar.gz
zcatch-8f8b35f3d24184796181c332f13473dbbfb157f1.zip
added way to join spectators when caught
Diffstat (limited to 'src/game/server/player.cpp')
-rw-r--r--src/game/server/player.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp
index d2d621b7..91a75c9d 100644
--- a/src/game/server/player.cpp
+++ b/src/game/server/player.cpp
@@ -421,6 +421,7 @@ void CPlayer::AddZCatchVictim(int ClientID, int reason)
 		// set victim's status
 		victim->m_CaughtBy = m_ClientID;
 		victim->m_SpecExplicit = false;
+		victim->m_zCatchJoinSpecWhenReleased = false;
 		victim->SetTeamDirect(TEAM_SPECTATORS);
 		victim->m_SpectatorID = m_ClientID;
 	}
@@ -443,6 +444,9 @@ void CPlayer::ReleaseZCatchVictim(int ClientID, int limit)
 				victim->m_CaughtBy = ZCATCH_NOT_CAUGHT;
 				victim->SetTeamDirect(GameServer()->m_pController->ClampTeam(1));
 				victim->m_SpectatorID = SPEC_FREEVIEW;
+				// SetTeam after SetTeamDirect, otherwise it would skip the message for joining the spectators
+				if(victim->m_zCatchJoinSpecWhenReleased)
+					victim->SetTeam(GameServer()->m_pController->ClampTeam(TEAM_SPECTATORS));
 			}
 			// delete from list
 			tmp = (*v)->prev;