send correct tunings to spectators

This commit is contained in:
HMH 2014-03-13 00:56:39 +01:00 committed by def
parent 78bed556c0
commit f2c8134bd2
2 changed files with 14 additions and 0 deletions

View file

@ -50,6 +50,9 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team)
m_DefEmote = EMOTE_NORMAL;
m_Afk = false;
m_LastWhisperTo = -1;
m_TuneZone = 0;
m_TuneZoneOld = m_TuneZone;
//New Year
if (g_Config.m_SvEvents)
@ -252,6 +255,15 @@ void CPlayer::Snap(int SnappingClient)
pSpectatorInfo->m_SpectatorID = m_SpectatorID;
pSpectatorInfo->m_X = m_ViewPos.x;
pSpectatorInfo->m_Y = m_ViewPos.y;
m_TuneZoneOld = m_TuneZone; // we want correct tunings also for spectators
int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_ViewPos);
m_TuneZone = GameServer()->Collision()->IsTune(CurrentIndex);
if (m_TuneZone != m_TuneZoneOld) // dont send tunigs all the time
{
GameServer()->SendTuningParams(SnappingClient, m_TuneZone);
}
}
// send 0 if times of others are not shown

View file

@ -41,6 +41,8 @@ public:
//---------------------------------------------------------
// this is used for snapping so we know how we can clip the view for the player
vec2 m_ViewPos;
int m_TuneZone;
int m_TuneZoneOld;
// states if the client is chatting, accessing a menu etc.
int m_PlayerFlags;