Introduce a mechanism to import old configs and use it for cl_antiping*

This commit is contained in:
heinrich5991 2015-09-10 12:30:29 +01:00
parent 27ed6d7033
commit 7512cc10d6
2 changed files with 15 additions and 6 deletions

View file

@ -3315,10 +3315,10 @@ int main(int argc, const char **argv) // ignore_convention
pClient->InitInterfaces();
// execute config file
IOHANDLE file = pStorage->OpenFile(CONFIG_FILE, IOFLAG_READ, IStorage::TYPE_ALL);
if(file)
IOHANDLE File = pStorage->OpenFile(CONFIG_FILE, IOFLAG_READ, IStorage::TYPE_ALL);
if(File)
{
io_close(file);
io_close(File);
pConsole->ExecuteFile(CONFIG_FILE);
}
else // fallback
@ -3327,10 +3327,10 @@ int main(int argc, const char **argv) // ignore_convention
}
// execute autoexec file
file = pStorage->OpenFile(AUTOEXEC_CLIENT_FILE, IOFLAG_READ, IStorage::TYPE_ALL);
if(file)
File = pStorage->OpenFile(AUTOEXEC_CLIENT_FILE, IOFLAG_READ, IStorage::TYPE_ALL);
if(File)
{
io_close(file);
io_close(File);
pConsole->ExecuteFile(AUTOEXEC_CLIENT_FILE);
}
else // fallback
@ -3338,6 +3338,14 @@ int main(int argc, const char **argv) // ignore_convention
pConsole->ExecuteFile(AUTOEXEC_FILE);
}
if(g_Config.m_ClConfigVersion < 1)
{
g_Config.m_ClAntiPingPlayers = 1;
g_Config.m_ClAntiPingGrenade = 1;
g_Config.m_ClAntiPingWeapons = 1;
}
g_Config.m_ClConfigVersion = 1;
// parse the command line arguments
if(argc > 1) // ignore_convention
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention

View file

@ -360,6 +360,7 @@ MACRO_CONFIG_INT(InpJoystick, inp_joystick, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT
#else
MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input")
#endif
MACRO_CONFIG_INT(ClConfigVersion, cl_config_version, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "The config version. Helps newer clients fix bugs with older configs.")
// demo editor
MACRO_CONFIG_INT(ClDemoSliceBegin, cl_demo_slice_begin, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Begin marker for demo slice")