mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
GameController: Add OnPlayerConnect() like in the upstream
This commit is contained in:
parent
a9bc6190eb
commit
a6bdda60ed
|
@ -1179,8 +1179,9 @@ void CGameContext::ProgressVoteOptions(int ClientID)
|
|||
|
||||
void CGameContext::OnClientEnter(int ClientID)
|
||||
{
|
||||
m_pController->OnPlayerConnect(m_apPlayers[ClientID]);
|
||||
|
||||
//world.insert_entity(&players[client_id]);
|
||||
m_apPlayers[ClientID]->Respawn();
|
||||
// init the player
|
||||
Score()->PlayerData(ClientID)->Reset();
|
||||
m_apPlayers[ClientID]->m_Score = Score()->PlayerData(ClientID)->m_BestTime ? Score()->PlayerData(ClientID)->m_BestTime : -9999;
|
||||
|
@ -1255,9 +1256,6 @@ void CGameContext::OnClientEnter(int ClientID)
|
|||
|
||||
if(g_Config.m_SvWelcome[0] != 0)
|
||||
SendChatTarget(ClientID, g_Config.m_SvWelcome);
|
||||
str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientID, Server()->ClientName(ClientID), m_apPlayers[ClientID]->GetTeam());
|
||||
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||
|
||||
IServer::CClientInfo Info;
|
||||
Server()->GetClientInfo(ClientID, &Info);
|
||||
|
|
|
@ -384,6 +384,19 @@ bool IGameController::OnEntity(int Index, vec2 Pos, int Layer, int Flags, int Nu
|
|||
return false;
|
||||
}
|
||||
|
||||
void IGameController::OnPlayerConnect(CPlayer *pPlayer)
|
||||
{
|
||||
int ClientID = pPlayer->GetCID();
|
||||
pPlayer->Respawn();
|
||||
|
||||
if(!Server()->ClientPrevIngame(ClientID))
|
||||
{
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientID, Server()->ClientName(ClientID), pPlayer->GetTeam());
|
||||
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void IGameController::OnPlayerDisconnect(class CPlayer *pPlayer, const char *pReason)
|
||||
{
|
||||
pPlayer->OnDisconnect();
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
*/
|
||||
virtual bool OnEntity(int Index, vec2 Pos, int Layer, int Flags, int Number = 0);
|
||||
|
||||
virtual void OnPlayerConnect(class CPlayer *pPlayer);
|
||||
virtual void OnPlayerDisconnect(class CPlayer *pPlayer, const char *pReason);
|
||||
|
||||
void OnReset();
|
||||
|
|
Loading…
Reference in a new issue