Skip to content

Commit

Permalink
Move command registrations to OnConsoleInit like in DDNet6
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Schumacher committed Jan 19, 2020
1 parent b3dc4fd commit 078bf54
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,21 @@ void CGameContext::OnConsoleInit()

Console()->Register("random_map", "?i[stars]", CFGFLAG_SERVER, ConRandomMap, this, "Random map");
Console()->Register("random_unfinished_map", "?i[stars]", CFGFLAG_SERVER, ConRandomUnfinishedMap, this, "Random unfinished map");

Console()->Chain("sv_motd", ConchainSpecialMotdupdate, this);

Console()->Chain("sv_vote_kick", ConchainSettingUpdate, this);
Console()->Chain("sv_vote_kick_min", ConchainSettingUpdate, this);
Console()->Chain("sv_vote_spectate", ConchainSettingUpdate, this);
Console()->Chain("sv_player_slots", ConchainSettingUpdate, this);

Console()->Chain("sv_scorelimit", ConchainGameinfoUpdate, this);
Console()->Chain("sv_timelimit", ConchainGameinfoUpdate, this);

#define CONSOLE_COMMAND(name, params, flags, callback, userdata, help) m_pConsole->Register(name, params, flags, callback, userdata, help);
#include <game/ddracecommands.h>
#define CHAT_COMMAND(name, params, flags, callback, userdata, help) m_pConsole->Register(name, params, flags, callback, userdata, help);
#include "ddracechat.h"
}

void CGameContext::OnInit()
Expand Down Expand Up @@ -2246,21 +2261,6 @@ void CGameContext::OnInit()
}
}

Console()->Chain("sv_motd", ConchainSpecialMotdupdate, this);

Console()->Chain("sv_vote_kick", ConchainSettingUpdate, this);
Console()->Chain("sv_vote_kick_min", ConchainSettingUpdate, this);
Console()->Chain("sv_vote_spectate", ConchainSettingUpdate, this);
Console()->Chain("sv_player_slots", ConchainSettingUpdate, this);

Console()->Chain("sv_scorelimit", ConchainGameinfoUpdate, this);
Console()->Chain("sv_timelimit", ConchainGameinfoUpdate, this);

#define CONSOLE_COMMAND(name, params, flags, callback, userdata, help) m_pConsole->Register(name, params, flags, callback, userdata, help);
#include <game/ddracecommands.h>
#define CHAT_COMMAND(name, params, flags, callback, userdata, help) m_pConsole->Register(name, params, flags, callback, userdata, help);
#include "ddracechat.h"

// clamp sv_player_slots to 0..MaxClients
if(Server()->MaxClients() < g_Config.m_SvPlayerSlots)
g_Config.m_SvPlayerSlots = Server()->MaxClients();
Expand Down

0 comments on commit 078bf54

Please sign in to comment.