mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Broadcast about DDNet client delayed a bit (fixes #72)
This commit is contained in:
parent
2acdf5ea17
commit
93d0f43a6a
|
@ -317,10 +317,8 @@ MACRO_CONFIG_INT(SvRankCheats, sv_rank_cheats, 0, 0, 1, CFGFLAG_SERVER, "Enable
|
|||
MACRO_CONFIG_INT(SvSpoofProtection, sv_spoof_protection, 0, 0, 1, CFGFLAG_SERVER, "Enable spoof protection")
|
||||
MACRO_CONFIG_INT(SvShutdownWhenEmpty, sv_shutdown_when_empty, 0, 0, 1, CFGFLAG_SERVER, "Shutdown server as soon as noone is on it anymore")
|
||||
MACRO_CONFIG_INT(SvKillProtection, sv_kill_protection, 20, 0, 9999, CFGFLAG_SERVER, "0 - Disable, 1-9999 minutes")
|
||||
MACRO_CONFIG_INT(SvClientSuggestion, sv_client_suggestion, 1, 0, 1, CFGFLAG_SERVER, "Enable suggestion to use DDNet client when joining a server")
|
||||
|
||||
MACRO_CONFIG_STR(SvClientSuggestionOther, sv_client_suggestion_other, 128, "Get the client from ddnet.tw to use all features on DDNet.", CFGFLAG_SERVER, "Broadcast to display to players without DDNet client")
|
||||
MACRO_CONFIG_STR(SvClientSuggestionOld, sv_client_suggestion_old, 128, "Your client version is old. Update it on ddnet.tw for new features!", CFGFLAG_SERVER, "Broadcast to display to players with an old version of DDNet client")
|
||||
MACRO_CONFIG_STR(SvClientSuggestion, sv_client_suggestion, 128, "Get the client from ddnet.tw to use all features on DDNet", CFGFLAG_SERVER, "Broadcast to display to players without DDNet client")
|
||||
//MACRO_CONFIG_STR(SvClientSuggestionOld, sv_client_suggestion_old, 128, "Your client version is old. Update it on ddnet.tw for new features!", CFGFLAG_SERVER, "Broadcast to display to players with an old version of DDNet client")
|
||||
|
||||
// netlimit
|
||||
MACRO_CONFIG_INT(SvNetlimit, sv_netlimit, 0, 0, 10000, CFGFLAG_SERVER, "Netlimit: Maximum amount of traffic a client is allowed to use (in kb/s)")
|
||||
|
|
|
@ -25,6 +25,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team)
|
|||
m_ClientID = ClientID;
|
||||
m_Team = GameServer()->m_pController->ClampTeam(Team);
|
||||
m_pCharacter = 0;
|
||||
m_NumInputs = 0;
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
@ -359,20 +360,20 @@ void CPlayer::OnPredictedInput(CNetObj_PlayerInput *NewInput)
|
|||
|
||||
AfkVoteTimer(NewInput);
|
||||
|
||||
if(m_FirstPacket)
|
||||
{
|
||||
if(g_Config.m_SvClientSuggestion)
|
||||
{
|
||||
if(m_ClientVersion <= VERSION_DDNET_OLD)
|
||||
GameServer()->SendBroadcast(g_Config.m_SvClientSuggestionOther, m_ClientID);
|
||||
//if(m_ClientVersion < CLIENT_VERSIONNR)
|
||||
// GameServer()->SendBroadcast(g_Config.m_SvClientSuggestionOld, m_ClientID);
|
||||
m_FirstPacket = false;
|
||||
}
|
||||
}
|
||||
m_NumInputs++;
|
||||
|
||||
if(m_pCharacter && !m_Paused)
|
||||
m_pCharacter->OnPredictedInput(NewInput);
|
||||
|
||||
// Magic number when we can hope that client has successfully identified itself
|
||||
if(m_NumInputs == 10)
|
||||
{
|
||||
if(g_Config.m_SvClientSuggestion[0] != '\0' && m_ClientVersion <= VERSION_DDNET_OLD)
|
||||
GameServer()->SendBroadcast(g_Config.m_SvClientSuggestion, m_ClientID);
|
||||
|
||||
//if(g_Config.m_SvClientSuggestionOld[0] != '\0' && m_ClientVersion < CLIENT_VERSIONNR)
|
||||
// GameServer()->SendBroadcast(g_Config.m_SvClientSuggestionOld, m_ClientID);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
||||
|
@ -391,8 +392,8 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
|||
if(m_pCharacter)
|
||||
m_pCharacter->ResetInput();
|
||||
|
||||
m_PlayerFlags = NewInput->m_PlayerFlags;
|
||||
return;
|
||||
m_PlayerFlags = NewInput->m_PlayerFlags;
|
||||
return;
|
||||
}
|
||||
|
||||
m_PlayerFlags = NewInput->m_PlayerFlags;
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
|
||||
private:
|
||||
CCharacter *m_pCharacter;
|
||||
int m_NumInputs;
|
||||
CGameContext *m_pGameServer;
|
||||
|
||||
CGameContext *GameServer() const { return m_pGameServer; }
|
||||
|
|
Loading…
Reference in a new issue