diff --git a/bin/fr_boooper.cfg b/bin/fr_boooper.cfg new file mode 100644 index 000000000..ec6be7794 --- /dev/null +++ b/bin/fr_boooper.cfg @@ -0,0 +1,40 @@ +# to start this funround type in rcon console: exec fr_boooper.cfg +# you can also add it as vote: add_vote "boooper round" exec fr_boooper.cfg + +set_cfg_for_nextround_begin # remember original config vars from this point on and reset them next round + +# only allow humans to be looper this round +inf_enable_engineer 0 +inf_enable_soldier 0 +inf_enable_scientist 0 +inf_enable_biologist 0 +inf_enable_looper 1 +inf_enable_mercenary 0 +inf_enable_sniper 0 +inf_enable_ninja 0 +inf_enable_medic 0 +inf_enable_hero 0 + +# only allow zombies to be boomer this round +inf_proba_smoker 0 +inf_proba_hunter 0 +inf_proba_bat 0 +inf_proba_boomer 100 +inf_proba_ghost 0 +inf_proba_spider 0 +inf_proba_ghoul 0 +inf_proba_slug 0 +inf_proba_voodoo 0 +inf_proba_witch 0 +inf_proba_undead 0 + +# change looper settings +inf_slow_motion_max_speed 0 # disable max speed +inf_slow_motion_gravity -25 # let zombies fly up +inf_slow_motion_gun_duration 20 # increase gun effect duration to 2 seconds +inf_slow_motion_wall_duration 20 # decrease wall effect duration to 2 seconds +inf_looper_barrier_life_span 30 # decrease wall time to 30 seconds + +set_cfg_for_nextround_end # stop remembering original config vars + +restart 1 # restarts round in 1 second diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 9f270a549..634f9c226 100755 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -32,6 +32,7 @@ #include "register.h" #include "server.h" +#include #include /* INFECTION MODIFICATION START ***************************************/ @@ -2850,6 +2851,9 @@ int main(int argc, const char **argv) // ignore_convention // restore empty config strings to their defaults pConfig->RestoreStrings(); + CCfgVarBuffer::RegisterConsoleCommands(((CConsole*)pConsole)); + CCfgVarBuffer::Init(); + pEngine->InitLogfile(); // run the server diff --git a/src/engine/shared/cfgvar_buffer.cpp b/src/engine/shared/cfgvar_buffer.cpp new file mode 100644 index 000000000..767371090 --- /dev/null +++ b/src/engine/shared/cfgvar_buffer.cpp @@ -0,0 +1,334 @@ +/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ +/* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modifications Copyright 2019 The InfclassR (https://github.com/yavl/teeworlds-infclassR/) Authors */ + +#include +#include +#include "cfgvar_buffer.h" +#include "config.h" +#include "console.h" +#include "string.h" + +int CCfgVarBuffer::m_CfgVarsNum; +CCfgVarBuffer::CfgVar *CCfgVarBuffer::m_pCfgVars; + +bool CCfgVarBuffer::m_BackupRoundCfgVars; +int CCfgVarBuffer::m_ResetNextRoundCounter; +CCfgVarBuffer::CfgVarBackup *CCfgVarBuffer::m_pCfgVarRoundBackup; + +CCfgVarBuffer::CfgVarBackup::CfgVarBackup() +{ + m_pCfgVarsTemp = new CfgVarTemp[m_CfgVarsNum]; + for (int i = 0; i < m_CfgVarsNum; i++) + { + m_pCfgVarsTemp[i].active = false; + m_pCfgVarsTemp[i].m_pStrValue = NULL; + } +} + +CCfgVarBuffer::CfgVarBackup::~CfgVarBackup() +{ + for (int i = 0; i < m_CfgVarsNum; i++) + { + delete[] m_pCfgVarsTemp[i].m_pStrValue; + } + delete[] m_pCfgVarsTemp; +} + +void CCfgVarBuffer::CfgVarBackup::Add(const char* pCfgVarScriptName, bool OverrideOld) +{ + int i = 0; + for ( ; i < m_CfgVarsNum; i++) + if (strcmp(m_pCfgVars[i].m_pScriptName, pCfgVarScriptName) == 0) break; + if (i >= m_CfgVarsNum) + { + dbg_msg("CfgVarBuffer", "Error: Could not find config variable '%s'", pCfgVarScriptName); + return; + } + if (!OverrideOld && m_pCfgVarsTemp[i].active) // var is already backed up + return; + if (OverrideOld && !m_pCfgVarsTemp[i].active) // nothing to override here + return; + m_pCfgVarsTemp[i].active = true; + // copy data to backup buffer + if (m_pCfgVars[i].m_Type == CFG_TYPE_INT) + { + m_pCfgVarsTemp[i].m_IntValue = *m_pCfgVars[i].m_pIntValue; + } + else if (m_pCfgVars[i].m_Type == CFG_TYPE_STR) + { + if (m_pCfgVarsTemp[i].m_pStrValue) + { + delete[] m_pCfgVarsTemp[i].m_pStrValue; + m_pCfgVarsTemp[i].m_pStrValue = NULL; + } + if (!m_pCfgVars[i].m_pStrValue) + return; + int StrSize = strlen(m_pCfgVars[i].m_pStrValue) + 1; + m_pCfgVarsTemp[i].m_pStrValue = new char[StrSize]; + str_copy(m_pCfgVarsTemp[i].m_pStrValue, m_pCfgVars[i].m_pStrValue, StrSize); + } + else + dbg_msg("CfgVarBuffer", "Error: config variable '%s' has an unknown type", pCfgVarScriptName); +} + +void CCfgVarBuffer::CfgVarBackup::ConsolePrint(CConsole *pConsole, const char *pCfgName) +{ + char aBuff[256]; + if (!pCfgName || pCfgName[0] == 0) + str_format(aBuff, 256, "Printing all cfg vars changed for this round :"); + else + str_format(aBuff, 256, "Printing all cfg vars changed for this round containing '%s' :", pCfgName); + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "- - - - - - - - - - - - - - - - - - - - - - - -"); + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuff); + + for (int i = 0; i < m_CfgVarsNum; i++) + { + if (!m_pCfgVarsTemp[i].active) continue; + if (pCfgName && pCfgName[0] != 0 && !strstr(m_pCfgVars[i].m_pScriptName, pCfgName)) continue; // check if pCfgName is a substring of m_pScriptName + char lineBuff[512]; + if (m_pCfgVars[i].m_Type == CFG_TYPE_INT) + str_format(lineBuff, 512, "%s %i -> %i", m_pCfgVars[i].m_pScriptName, m_pCfgVarsTemp[i].m_IntValue, *m_pCfgVars[i].m_pIntValue); + else + { + if (strstr(m_pCfgVars[i].m_pScriptName, "password")) // dont print passwords + str_format(lineBuff, 512, "%s *****************", m_pCfgVars[i].m_pScriptName); + else if (m_pCfgVarsTemp[i].m_pStrValue && m_pCfgVars[i].m_pStrValue) + str_format(lineBuff, 512, "%s %s -> %s", m_pCfgVars[i].m_pScriptName, m_pCfgVarsTemp[i].m_pStrValue, m_pCfgVars[i].m_pStrValue); + else if (m_pCfgVarsTemp[i].m_pStrValue && !m_pCfgVars[i].m_pStrValue) + str_format(lineBuff, 512, "%s %s -> NULL", m_pCfgVars[i].m_pScriptName, m_pCfgVarsTemp[i].m_pStrValue); + else if (!m_pCfgVarsTemp[i].m_pStrValue && m_pCfgVars[i].m_pStrValue) + str_format(lineBuff, 512, "%s NULL -> %s", m_pCfgVars[i].m_pScriptName, m_pCfgVars[i].m_pStrValue); + else if (!m_pCfgVarsTemp[i].m_pStrValue && !m_pCfgVars[i].m_pStrValue) + str_format(lineBuff, 512, "%s NULL -> NULL", m_pCfgVars[i].m_pScriptName); + } + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", lineBuff); + } +} + +void CCfgVarBuffer::CfgVarBackup::Apply() +{ + for (int i = 0; i < m_CfgVarsNum; i++) + { + if (!m_pCfgVarsTemp[i].active) continue; + if (m_pCfgVars[i].m_Type == CFG_TYPE_INT) + *m_pCfgVars[i].m_pIntValue = m_pCfgVarsTemp[i].m_IntValue; + else + { + if (!m_pCfgVarsTemp[i].m_pStrValue) + dbg_msg("CfgVarBuffer", "Error: cannot apply cfg backup for config variable '%s' -> NULL pointer string", m_pCfgVars[i].m_pScriptName); + else + str_copy(m_pCfgVars[i].m_pStrValue, m_pCfgVarsTemp[i].m_pStrValue, strlen(m_pCfgVarsTemp[i].m_pStrValue)+1); + } + } +} + +void CCfgVarBuffer::Init() +{ + m_BackupRoundCfgVars = false; + m_ResetNextRoundCounter = 0; + delete m_pCfgVarRoundBackup; + m_pCfgVarRoundBackup = NULL; + + // Count how many config variables there are + m_CfgVarsNum = 0; + #define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Flags,Desc) \ + { \ + m_CfgVarsNum++; \ + } + + #define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Flags,Desc) \ + { \ + m_CfgVarsNum++; \ + } + + #include "config_variables.h" + #include "game/variables.h" + + #undef MACRO_CONFIG_INT + #undef MACRO_CONFIG_STR + + m_pCfgVars = new CfgVar[m_CfgVarsNum]; + int tCount = 0; + + // read all config variables and save their information to m_pCfgVars + #define MACRO_CFGVAR_SAVE_NAME(ScriptName) \ + { \ + int i = strlen(#ScriptName) + 1; \ + m_pCfgVars[tCount].m_pScriptName = new char[i]; \ + m_pCfgVars[tCount].m_ScriptNameLength = i; \ + str_copy(m_pCfgVars[tCount].m_pScriptName, #ScriptName, i); \ + m_pCfgVars[tCount].m_pScriptName[i-1] = 0; \ + } + + #define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Flags,Desc) \ + { \ + m_pCfgVars[tCount].m_Type = CFG_TYPE_INT; \ + m_pCfgVars[tCount].m_pIntValue = &g_Config.m_##Name; \ + MACRO_CFGVAR_SAVE_NAME(ScriptName); \ + tCount++; \ + } + + #define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Flags,Desc) \ + { \ + m_pCfgVars[tCount].m_Type = CFG_TYPE_STR; \ + m_pCfgVars[tCount].m_pStrValue = g_Config.m_##Name; \ + MACRO_CFGVAR_SAVE_NAME(ScriptName); \ + tCount++; \ + } + + #include "config_variables.h" + #include "game/variables.h" + + #undef MACRO_CONFIG_INT + #undef MACRO_CONFIG_STR + #undef MACRO_CFGVAR_SAVE_NAME +} + +void CCfgVarBuffer::RegisterConsoleCommands(CConsole *pConsole) +{ + pConsole->Register("set_cfg_for_nextround_begin", "", CFGFLAG_SERVER, ConSetCfgForNextRound_Begin, pConsole, + "cfg var changes between this begin command and the end command will be reset at the end of next round"); + pConsole->Register("set_cfg_for_nextround_end", "", CFGFLAG_SERVER, ConSetCfgForNextRound_End, pConsole, + "cfg var changes between the begin command and this end command will be reset at the end of next round"); + pConsole->Register("print_round_cfg", "?s", CFGFLAG_SERVER, ConPrintRoundCfg, pConsole, + "show round specifc config vars, format: config_var original_value -> temp_value"); +} + +bool CCfgVarBuffer::IsConfigVar(const char* pStr) +{ + if (!pStr) return false; + for (int i = 0; i < m_CfgVarsNum; i++) + { + if (str_comp_nocase(m_pCfgVars[i].m_pScriptName, pStr) == 0) return true; + } + return false; +} + +void CCfgVarBuffer::ConPrintCfg(CConsole* pConsole, const char *pCfgName) +{ + char aBuff[256]; + if (!pCfgName || pCfgName[0] == 0) + str_format(aBuff, 256, "Printing all config variables :"); + else + str_format(aBuff, 256, "Printing all config variables containing '%s' :", pCfgName); + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "- - - - - - - - - - - - - - - - - - - - - - - -"); + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuff); + + // search for config vars that contain pCfgName and print them and their values - if pCfgName is NULL print all vars + for (int i = 0; i < m_CfgVarsNum; i++) + { + if (pCfgName && pCfgName[0] != 0) + if (!strstr(m_pCfgVars[i].m_pScriptName, pCfgName)) continue; + + char lineBuff[512]; + if (m_pCfgVars[i].m_Type == CFG_TYPE_INT) + str_format(lineBuff, 512, "%s %i", m_pCfgVars[i].m_pScriptName, *m_pCfgVars[i].m_pIntValue); + else + { + if (strstr(m_pCfgVars[i].m_pScriptName, "password")) // dont print passwords + str_format(lineBuff, 512, "%s *****************", m_pCfgVars[i].m_pScriptName); + else + { + if (m_pCfgVars[i].m_pStrValue) + str_format(lineBuff, 512, "%s %s", m_pCfgVars[i].m_pScriptName, m_pCfgVars[i].m_pStrValue); + else + str_format(lineBuff, 512, "%s NULL", m_pCfgVars[i].m_pScriptName); + } + } + pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", lineBuff); + } +} + +bool CCfgVarBuffer::ConSetCfgForNextRound_Begin(IConsole::IResult *pResult, void *pUserData) +{ + //((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "Reset upcomming config variables at the end of next round"); + m_BackupRoundCfgVars = true; + m_ResetNextRoundCounter = 2; + if (m_pCfgVarRoundBackup) + { + m_pCfgVarRoundBackup->Apply(); + delete m_pCfgVarRoundBackup; + } + m_pCfgVarRoundBackup = new CfgVarBackup(); + return true; +} + +bool CCfgVarBuffer::ConSetCfgForNextRound_End(IConsole::IResult *pResult, void *pUserData) +{ + m_BackupRoundCfgVars = false; + return true; +} + +bool CCfgVarBuffer::ConPrintRoundCfg(IConsole::IResult *pResult, void *pUserData) +{ + if (!m_pCfgVarRoundBackup) + { + ((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "Round cfg vars are disabled, you can activate them with resetcfg_nextround_start"); + return true; + } + m_pCfgVarRoundBackup->ConsolePrint((CConsole*)pUserData, pResult->GetString(0)); + return true; +} + +void CCfgVarBuffer::BeforeSetCfg(const char* pCfgVarScriptName) +{ + if (!m_BackupRoundCfgVars) return; + if (!m_pCfgVarRoundBackup) return; + if (!IsConfigVar(pCfgVarScriptName)) return; + m_pCfgVarRoundBackup->Add(pCfgVarScriptName); +} + +void CCfgVarBuffer::AfterSetCfg(const char* pCfgVarScriptName) +{ + if (m_BackupRoundCfgVars) return; + if (!m_pCfgVarRoundBackup) return; + if (!IsConfigVar(pCfgVarScriptName)) return; + m_pCfgVarRoundBackup->Add(pCfgVarScriptName, true); +} + +void CCfgVarBuffer::OnRoundStart() +{ + if (m_ResetNextRoundCounter <= 0) return; + m_ResetNextRoundCounter--; + if (m_ResetNextRoundCounter > 0) return; + + m_pCfgVarRoundBackup->Apply(); + + // reset + delete m_pCfgVarRoundBackup; + m_pCfgVarRoundBackup = NULL; + m_BackupRoundCfgVars = false; +} + +/* +// puts all config vars and their values inside a string +// returns false if it runs out of memory +bool CCfgVarBuffer::GetCfgStr(char *pStr, int StrSize) +{ + for (int i = 0; i < m_CfgVarsNum; i++) + { + char lineBuff[512]; + if (m_pCfgVars[i].m_Type == CFG_TYPE_INT) + str_format(lineBuff, 512, "%s %i \n", m_pCfgVars[i].m_pScriptName, *m_pCfgVars[i].m_pIntValue); + else + str_format(lineBuff, 512, "%s %s \n", m_pCfgVars[i].m_pScriptName, m_pCfgVars[i].m_pStrValue); + int m = 0; + for ( ; m < 512; m++) + if (lineBuff[m] == 0) break; + if (StrSize-m <= 0) + { + *pStr = 0; + dbg_msg("GetCfgStr", "Error: out of memory"); + return false; + } + for (int u = 0; u < m; u++) + pStr[u] = lineBuff[u]; + StrSize -= m; + pStr += m; + } + *pStr = 0; + return true; +} +*/ + diff --git a/src/engine/shared/cfgvar_buffer.h b/src/engine/shared/cfgvar_buffer.h new file mode 100644 index 000000000..39eae856d --- /dev/null +++ b/src/engine/shared/cfgvar_buffer.h @@ -0,0 +1,76 @@ +/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ +/* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modifications Copyright 2019 The InfclassR (https://github.com/yavl/teeworlds-infclassR/) Authors */ + +#ifndef ENGINE_SHARED_CFGVAR_BUFFER_H +#define ENGINE_SHARED_CFGVAR_BUFFER_H + +#include +#include +#include "console.h" + +class CCfgVarBuffer +{ + + enum + { + CFG_TYPE_INT = 0, + CFG_TYPE_STR = 1 + }; + + struct CfgVar + { + int m_Type; // CFG_TYPE_INT or CFG_TYPE_STR + char *m_pScriptName; // for example "sv_rcon_password" + int m_ScriptNameLength; + int *m_pIntValue; // contains pointer to get/set and int config var + char *m_pStrValue; // contains pointer to get/set a string config var + }; + + struct CfgVarTemp + { + bool active; + int m_IntValue; + char *m_pStrValue; + }; + + // use delete on objects from this class if you dont need them anymore + class CfgVarBackup + { + public: + CfgVarBackup(); + ~CfgVarBackup(); + void Add(const char* pCfgVarScriptName, bool OverrideOld = false); + void ConsolePrint(CConsole *pConsole, const char *pCfgName = NULL); + void Apply(); + + private: + CfgVarTemp *m_pCfgVarsTemp; + }; + +public: + static void Init(); + static void RegisterConsoleCommands(CConsole *pConsole); + static bool IsConfigVar(const char* pStr); + + static void ConPrintCfg(CConsole* pConsole, const char *pCfgName); + static bool ConSetCfgForNextRound_Begin(IConsole::IResult *pResult, void *pUserData); + static bool ConSetCfgForNextRound_End(IConsole::IResult *pResult, void *pUserData); + static bool ConPrintRoundCfg(IConsole::IResult *pResult, void *pUserData); + + static void BeforeSetCfg(const char* pCfgVarScriptName); + static void AfterSetCfg(const char* pCfgVarScriptName); + static void OnRoundStart(); + +private: + static CfgVar *m_pCfgVars; // array that contains the name and pointers of all config vars once + static int m_CfgVarsNum; // how many different config vars there are - how many elements inside m_CfgVars + + static bool m_BackupRoundCfgVars; + static int m_ResetNextRoundCounter; + static CfgVarBackup *m_pCfgVarRoundBackup; // saves config vars in the same order as m_pCfgVars to restore them at the end of a round + +}; + + +#endif diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index c8711f9c2..2fe46d655 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modifications Copyright 2019 The InfclassR (https://github.com/yavl/teeworlds-infclassR/) Authors */ #include #include @@ -8,9 +9,11 @@ #include #include +#include "string.h" #include "config.h" #include "console.h" #include "linereader.h" +#include "cfgvar_buffer.h" // todo: rework this @@ -362,6 +365,8 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, bo } else { + CCfgVarBuffer::BeforeSetCfg(pCommand->m_pName); + bool ValideArguments = pCommand->m_pfnCallback(&Result, pCommand->m_pUserData); if(!ValideArguments) { @@ -372,6 +377,8 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, bo Print(OUTPUT_LEVEL_STANDARD, "Console", "Invalid arguments."); Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf); } + + CCfgVarBuffer::AfterSetCfg(pCommand->m_pName); } } } @@ -483,14 +490,46 @@ void CConsole::ExecuteFile(const char *pFilename) bool CConsole::Con_Echo(IResult *pResult, void *pUserData) { ((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", pResult->GetString(0)); - return true; } bool CConsole::Con_Exec(IResult *pResult, void *pUserData) { ((CConsole*)pUserData)->ExecuteFile(pResult->GetString(0)); - + return true; +} + +bool CConsole::Con_PrintCfg(IResult *pResult, void *pUserData) +{ + CCfgVarBuffer::ConPrintCfg(((CConsole*)pUserData), pResult->GetString(0)); + return true; +} + +bool CConsole::Con_PrintCmd(IResult *pResult, void *pUserData) +{ + char aBuff[256]; + if (!pResult->GetString(0) || pResult->GetString(0)[0] == 0) + str_format(aBuff, 256, "Printing all commands :"); + else + str_format(aBuff, 256, "Printing all commands containing '%s' :", pResult->GetString(0)); + ((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "- - - - - - - - - - - - - - - - - - - - - - - -"); + ((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuff); + + const char *pCmdName = pResult->GetString(0); + for(CCommand *pCommand = ((CConsole*)pUserData)->m_pFirstCommand; pCommand; pCommand = pCommand->m_pNext) + { + if (CCfgVarBuffer::IsConfigVar(pCommand->m_pName)) continue; + + if (pCmdName && pCmdName[0] != 0) + if (!strstr(pCommand->m_pName, pCmdName)) continue; // continue if command doesnt contain pCmdName + + char lineBuff[512]; + if (pCommand->m_pUsage && pCommand->m_pUsage[0] != 0) + str_format(lineBuff, 512, "%s %s -> %s", pCommand->m_pName, pCommand->m_pUsage, pCommand->m_pHelp); + else + str_format(lineBuff, 512, "%s -> %s", pCommand->m_pName, pCommand->m_pHelp); + ((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", lineBuff); + } return true; } @@ -717,6 +756,9 @@ CConsole::CConsole(int FlagMask) Register("echo", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_Echo, this, "Echo the text"); Register("exec", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_Exec, this, "Execute the specified file"); + Register("print_cfg", "?s", CFGFLAG_SERVER, Con_PrintCfg, this, "Search for config vars that contain X and print their names and values"); + Register("print_cmd", "?s", CFGFLAG_SERVER, Con_PrintCmd, this, "Search for commandos that contain X and print them"); + Register("toggle", "sii", CFGFLAG_SERVER|CFGFLAG_CLIENT, ConToggle, this, "Toggle config value"); Register("+toggle", "sii", CFGFLAG_CLIENT, ConToggleStroke, this, "Toggle config value via keypress"); diff --git a/src/engine/shared/console.h b/src/engine/shared/console.h index a13003b98..6743c0d74 100644 --- a/src/engine/shared/console.h +++ b/src/engine/shared/console.h @@ -1,8 +1,10 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modifications Copyright 2019 The InfclassR (https://github.com/yavl/teeworlds-infclassR/) Authors */ #ifndef ENGINE_SHARED_CONSOLE_H #define ENGINE_SHARED_CONSOLE_H +#include #include #include "memheap.h" @@ -54,6 +56,8 @@ class CConsole : public IConsole static bool Con_Chain(IResult *pResult, void *pUserData); static bool Con_Echo(IResult *pResult, void *pUserData); static bool Con_Exec(IResult *pResult, void *pUserData); + static bool Con_PrintCfg(IResult *pResult, void *pUserData); + static bool Con_PrintCmd(IResult *pResult, void *pUserData); static bool ConToggle(IResult *pResult, void *pUser); static bool ConToggleStroke(IResult *pResult, void *pUser); static bool ConModCommandAccess(IResult *pResult, void *pUser); diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index cb385fbb7..414b6557c 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -1,6 +1,8 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modifications Copyright 2019 The InfclassR (https://github.com/yavl/teeworlds-infclassR/) Authors */ #include +#include #include #include @@ -136,6 +138,7 @@ void IGameController::StartRound() { ResetGame(); + CCfgVarBuffer::OnRoundStart(); Server()->OnRoundStart(); GameServer()->OnStartRound();