mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
restore empty strings in the config to their defaults on startup
This commit is contained in:
parent
d37c83962d
commit
1cde96ef79
|
@ -2031,6 +2031,9 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
if(argc > 1) // ignore_convention
|
||||
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
||||
|
||||
// restore empty config strings to their defaults
|
||||
pConfig->RestoreStrings();
|
||||
|
||||
m_Client.Engine()->InitLogfile();
|
||||
|
||||
// run the client
|
||||
|
|
|
@ -11,6 +11,7 @@ public:
|
|||
|
||||
virtual void Init() = 0;
|
||||
virtual void Reset() = 0;
|
||||
virtual void RestoreStrings() = 0;
|
||||
virtual void Save() = 0;
|
||||
|
||||
virtual void RegisterCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData) = 0;
|
||||
|
|
|
@ -1432,6 +1432,9 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
// parse the command line arguments
|
||||
if(argc > 1) // ignore_convention
|
||||
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
||||
|
||||
// restore empty config strings to their defaults
|
||||
pConfig->RestoreStrings();
|
||||
|
||||
pServer->Engine()->InitLogfile();
|
||||
|
||||
|
|
|
@ -58,6 +58,17 @@ public:
|
|||
#undef MACRO_CONFIG_INT
|
||||
#undef MACRO_CONFIG_STR
|
||||
}
|
||||
|
||||
virtual void RestoreStrings()
|
||||
{
|
||||
#define MACRO_CONFIG_INT(Name,ScriptName,def,min,max,flags,desc) // nop
|
||||
#define MACRO_CONFIG_STR(Name,ScriptName,len,def,flags,desc) if(!g_Config.m_##Name[0] && def[0]) str_copy(g_Config.m_##Name, def, len);
|
||||
|
||||
#include "config_variables.h"
|
||||
|
||||
#undef MACRO_CONFIG_INT
|
||||
#undef MACRO_CONFIG_STR
|
||||
}
|
||||
|
||||
virtual void Save()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue