[server] Implement ServerMaxPlayersChanged

This commit is contained in:
RD42 2023-12-13 23:55:56 +08:00
parent 0896d3b9bb
commit b8177ad679
2 changed files with 16 additions and 1 deletions

View File

@ -139,7 +139,19 @@ void ServerPasswordChanged()
void ServerMaxPlayersChanged()
{
// TODO: ServerMaxPlayersChanged
int maxplayers = pConsole->GetIntVariable("maxplayers");
if (maxplayers < 0)
pConsole->SetIntVariable("maxplayers", 0);
if (maxplayers > MAX_PLAYERS)
pConsole->SetIntVariable("maxplayers", MAX_PLAYERS);
if (pNetGame)
{
if (pConsole->GetIntVariable("maxplayers") > MAX_PLAYERS) {
pConsole->SetIntVariable("maxplayers", MAX_PLAYERS);
}
pNetGame->GetRakServer()->SetAllowedPlayers((WORD)pConsole->GetIntVariable("maxplayers"));
}
}
//----------------------------------------------------

View File

@ -60,6 +60,9 @@ public:
void Init(BOOL bFirst);
void ShutdownForGameModeRestart();
RakServerInterface * GetRakServer() { return m_pRak; };
void Process();
void LoadBanList();