mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Add reload_censorlist
to reread censorlist.txt
This commit is contained in:
parent
0369946156
commit
e8e52a8b66
|
@ -887,6 +887,12 @@ void CGameContext::ConDrySave(IConsole::IResult *pResult, void *pUserData)
|
|||
io_close(File);
|
||||
}
|
||||
|
||||
void CGameContext::ConReloadCensorlist(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
pSelf->ReadCensorList();
|
||||
}
|
||||
|
||||
void CGameContext::ConDumpAntibot(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
|
|
@ -3642,6 +3642,7 @@ void CGameContext::OnConsoleInit()
|
|||
Console()->Register("set_team", "i[id] i[team-id] ?i[delay in minutes]", CFGFLAG_SERVER, ConSetTeam, this, "Set team of player to team");
|
||||
Console()->Register("set_team_all", "i[team-id]", CFGFLAG_SERVER, ConSetTeamAll, this, "Set team of all players to team");
|
||||
Console()->Register("hot_reload", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConHotReload, this, "Reload the map while preserving the state of tees and teams");
|
||||
Console()->Register("reload_censorlist", "", CFGFLAG_SERVER, ConReloadCensorlist, this, "Reload the censorlist");
|
||||
|
||||
Console()->Register("add_vote", "s[name] r[command]", CFGFLAG_SERVER, ConAddVote, this, "Add a voting option");
|
||||
Console()->Register("remove_vote", "r[name]", CFGFLAG_SERVER, ConRemoveVote, this, "remove a voting option");
|
||||
|
@ -3933,19 +3934,7 @@ void CGameContext::OnInit(const void *pPersistentData)
|
|||
else
|
||||
m_pController = new CGameControllerDDRace(this);
|
||||
|
||||
const char *pCensorFilename = "censorlist.txt";
|
||||
CLineReader LineReader;
|
||||
if(LineReader.OpenFile(Storage()->OpenFile(pCensorFilename, IOFLAG_READ, IStorage::TYPE_ALL)))
|
||||
{
|
||||
while(const char *pLine = LineReader.Get())
|
||||
{
|
||||
m_vCensorlist.emplace_back(pLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_msg("censorlist", "failed to open '%s'", pCensorFilename);
|
||||
}
|
||||
ReadCensorList();
|
||||
|
||||
m_TeeHistorianActive = g_Config.m_SvTeeHistorian;
|
||||
if(m_TeeHistorianActive)
|
||||
|
@ -4989,3 +4978,21 @@ void CGameContext::OnUpdatePlayerServerInfo(CJsonStringWriter *pJSonWriter, int
|
|||
pJSonWriter->WriteAttribute("team");
|
||||
pJSonWriter->WriteIntValue(Team);
|
||||
}
|
||||
|
||||
void CGameContext::ReadCensorList()
|
||||
{
|
||||
const char *pCensorFilename = "censorlist.txt";
|
||||
CLineReader LineReader;
|
||||
m_vCensorlist.clear();
|
||||
if(LineReader.OpenFile(Storage()->OpenFile(pCensorFilename, IOFLAG_READ, IStorage::TYPE_ALL)))
|
||||
{
|
||||
while(const char *pLine = LineReader.Get())
|
||||
{
|
||||
m_vCensorlist.emplace_back(pLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_msg("censorlist", "failed to open '%s'", pCensorFilename);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -363,6 +363,7 @@ public:
|
|||
bool RateLimitPlayerMapVote(int ClientId) const;
|
||||
|
||||
void OnUpdatePlayerServerInfo(CJsonStringWriter *pJSonWriter, int Id) override;
|
||||
void ReadCensorList();
|
||||
|
||||
std::shared_ptr<CScoreRandomMapResult> m_SqlRandomMapResult;
|
||||
|
||||
|
@ -514,6 +515,8 @@ private:
|
|||
static void ConFreezeHammer(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConReloadCensorlist(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
CCharacter *GetPracticeCharacter(IConsole::IResult *pResult);
|
||||
|
||||
enum
|
||||
|
|
Loading…
Reference in a new issue