added a sample config file
authorDavid Anderson <dvander@alliedmods.net>
Thu Apr 05 17:56:06 2007 +0000 (2007-04-05)
changeset 306099c92dfd2d4
parent 305 539f25c00858
child 307 f96e6461132b
added a sample config file
added a restart option to the config file
update_tool/sourcemm_updater.conf
update_tool/update_tool.cpp
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/update_tool/sourcemm_updater.conf	Thu Apr 05 17:56:06 2007 +0000
     1.3 @@ -0,0 +1,9 @@
     1.4 +;Use this to configure where Metamod resides, if you have
     1.5 +;changed its location
     1.6 +;mmpath = addons/metamod/bin
     1.7 +
     1.8 +;Use this to specify how the updater tool restarts SourceDS
     1.9 +; never - don't restart
    1.10 +; error - restart by generating a fatal error message
    1.11 +; quit  - restart by issuing a "quit" server command
    1.12 +restart = error
     2.1 --- a/update_tool/update_tool.cpp	Thu Apr 05 17:51:23 2007 +0000
     2.2 +++ b/update_tool/update_tool.cpp	Thu Apr 05 17:56:06 2007 +0000
     2.3 @@ -43,6 +43,15 @@
     2.4  	char gamedir[260];
     2.5  	char mmpath[260];
     2.6  
     2.7 +	enum RestartMode
     2.8 +	{
     2.9 +		Restart_Never,
    2.10 +		Restart_Error,
    2.11 +		Restart_Quit,
    2.12 +	};
    2.13 +
    2.14 +	RestartMode mode = Restart_Error;
    2.15 +
    2.16  	GetGameDir(gamedir, sizeof(gamedir));
    2.17  
    2.18  	/* Defaults */
    2.19 @@ -111,10 +120,25 @@
    2.20  				input++;
    2.21  			}
    2.22  
    2.23 +			/* Ignore comments */
    2.24 +			if (key[0] == ';')
    2.25 +			{
    2.26 +				continue;
    2.27 +			}
    2.28 +
    2.29  			/* The rest is our key */
    2.30  			if (strcmp(key, "mmpath") == 0)
    2.31  			{
    2.32  				UTIL_Format(mmpath, sizeof(mmpath), "%s", input);
    2.33 +			} else if (strcmp(key, "restart") == 0) {
    2.34 +				if (strcmp(input, "never") == 0)
    2.35 +				{
    2.36 +					mode = Restart_Never;
    2.37 +				} else if (strcmp(input, "error") == 0) {
    2.38 +					mode = Restart_Error;
    2.39 +				} else if (strcmp(input, "quit") == 0) {
    2.40 +					mode = Restart_Never;
    2.41 +				}
    2.42  			}
    2.43  		}
    2.44  		fclose(fpCfg);
    2.45 @@ -266,7 +290,12 @@
    2.46  	}
    2.47  	RemoveFile(new_path);
    2.48  
    2.49 -	Error("Server is restarting to load Metamod:Source");
    2.50 +	if (mode == Restart_Error)
    2.51 +	{
    2.52 +		Error("Server is restarting to load Metamod:Source");
    2.53 +	} else if (mode == Restart_Quit) {
    2.54 +		ServerCommand("quit\n");
    2.55 +	}
    2.56  }
    2.57  
    2.58  bool RemoveFile(const char *file)