(svn r1918) -Fix: [ 1101874 ] Dedicated server now accepts '-g' (load game) as param

This commit is contained in:
truelight 2005-03-01 17:32:47 +00:00
parent ccbb6263ea
commit 6519d3bc97

View File

@ -44,6 +44,9 @@ int dup2(int oldd, int newd) { return -1; }
static void *_dedicated_video_mem; static void *_dedicated_video_mem;
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
extern void SwitchMode(int new_mode);
#ifdef UNIX #ifdef UNIX
/* We want to fork our dedicated server */ /* We want to fork our dedicated server */
void DedicatedFork(void) void DedicatedFork(void)
@ -255,10 +258,27 @@ static int DedicatedVideoMainLoop(void)
// Load the dedicated server stuff // Load the dedicated server stuff
_is_network_server = true; _is_network_server = true;
_network_dedicated = true; _network_dedicated = true;
_switch_mode = SM_NONE;
_network_playas = OWNER_SPECTATOR; _network_playas = OWNER_SPECTATOR;
_local_player = OWNER_SPECTATOR; _local_player = OWNER_SPECTATOR;
/* If SwitchMode is SM_LOAD, it means that the user used the '-g' options */
if (_switch_mode != SM_LOAD) {
_switch_mode = SM_NONE;
DoCommandP(0, Random(), InteractiveRandom(), NULL, CMD_GEN_RANDOM_NEW_GAME); DoCommandP(0, Random(), InteractiveRandom(), NULL, CMD_GEN_RANDOM_NEW_GAME);
} else {
_switch_mode = SM_NONE;
/* First we need to test if the savegame can be loaded, else we will end up playing the
* intro game... */
if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL)) {
/* Loading failed, pop out.. */
DEBUG(net, 0)("Loading request map failed. Aborting..");
_networking = false;
} else {
/* We can load this game, so go ahead */
SwitchMode(SM_LOAD);
}
}
// Done loading, start game! // Done loading, start game!
if (!_networking) { if (!_networking) {