mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-12-01 13:24:25 +01:00
added a sample config file
added a restart option to the config file --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40360
This commit is contained in:
parent
05e09416ef
commit
048cac087e
9
update_tool/sourcemm_updater.conf
Normal file
9
update_tool/sourcemm_updater.conf
Normal file
@ -0,0 +1,9 @@
|
||||
;Use this to configure where Metamod resides, if you have
|
||||
;changed its location
|
||||
;mmpath = addons/metamod/bin
|
||||
|
||||
;Use this to specify how the updater tool restarts SourceDS
|
||||
; never - don't restart
|
||||
; error - restart by generating a fatal error message
|
||||
; quit - restart by issuing a "quit" server command
|
||||
restart = error
|
@ -43,6 +43,15 @@ extern "C" void _LoadFunction()
|
||||
char gamedir[260];
|
||||
char mmpath[260];
|
||||
|
||||
enum RestartMode
|
||||
{
|
||||
Restart_Never,
|
||||
Restart_Error,
|
||||
Restart_Quit,
|
||||
};
|
||||
|
||||
RestartMode mode = Restart_Error;
|
||||
|
||||
GetGameDir(gamedir, sizeof(gamedir));
|
||||
|
||||
/* Defaults */
|
||||
@ -111,10 +120,25 @@ extern "C" void _LoadFunction()
|
||||
input++;
|
||||
}
|
||||
|
||||
/* Ignore comments */
|
||||
if (key[0] == ';')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* The rest is our key */
|
||||
if (strcmp(key, "mmpath") == 0)
|
||||
{
|
||||
UTIL_Format(mmpath, sizeof(mmpath), "%s", input);
|
||||
} else if (strcmp(key, "restart") == 0) {
|
||||
if (strcmp(input, "never") == 0)
|
||||
{
|
||||
mode = Restart_Never;
|
||||
} else if (strcmp(input, "error") == 0) {
|
||||
mode = Restart_Error;
|
||||
} else if (strcmp(input, "quit") == 0) {
|
||||
mode = Restart_Never;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fpCfg);
|
||||
@ -266,7 +290,12 @@ extern "C" void _LoadFunction()
|
||||
}
|
||||
RemoveFile(new_path);
|
||||
|
||||
Error("Server is restarting to load Metamod:Source");
|
||||
if (mode == Restart_Error)
|
||||
{
|
||||
Error("Server is restarting to load Metamod:Source");
|
||||
} else if (mode == Restart_Quit) {
|
||||
ServerCommand("quit\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool RemoveFile(const char *file)
|
||||
|
Loading…
Reference in New Issue
Block a user