diff options
author | Simon Howard | 2011-09-05 21:57:23 +0000 |
---|---|---|
committer | Simon Howard | 2011-09-05 21:57:23 +0000 |
commit | 9ff63977237ba7d7edb7f863c9a6ad4dd5b07cbe (patch) | |
tree | 24897cb4eb0e08f5e53ce2248c87603542e4f5fd /src/doom | |
parent | b2318d4849a6cd033372ef9164cd06b74c78583c (diff) | |
download | chocolate-doom-9ff63977237ba7d7edb7f863c9a6ad4dd5b07cbe.tar.gz chocolate-doom-9ff63977237ba7d7edb7f863c9a6ad4dd5b07cbe.tar.bz2 chocolate-doom-9ff63977237ba7d7edb7f863c9a6ad4dd5b07cbe.zip |
Refactor savegamedir calculation code to work the same as trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 2360
Diffstat (limited to 'src/doom')
-rw-r--r-- | src/doom/d_main.c | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c index f626d408..0e5324b4 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -786,40 +786,6 @@ void D_SetGameDescription(void) } } -static void SetSaveGameDir(char *iwad_filename) -{ - char *sep; - char *basefile; - - // Extract the base filename - - sep = strrchr(iwad_filename, DIR_SEPARATOR); - - if (sep == NULL) - { - basefile = iwad_filename; - } - else - { - basefile = sep + 1; - } - - // ~/.chocolate-doom/savegames/ - - savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0); - sprintf(savegamedir, "%ssavegames%c", configdir, - DIR_SEPARATOR); - - M_MakeDirectory(savegamedir); - - // eg. ~/.chocolate-doom/savegames/doom2.wad/ - - sprintf(savegamedir + strlen(savegamedir), "%s%c", - basefile, DIR_SEPARATOR); - - M_MakeDirectory(savegamedir); -} - // Check if the IWAD file is the Chex Quest IWAD. // Returns true if this is chex.wad. @@ -1121,6 +1087,27 @@ static void LoadHacxDeh(void) } } +// Figure out what IWAD name to use for savegames. + +static char *SaveGameIWADName(void) +{ + // Chex quest hack + + if (gameversion == exe_chex) + { + return "chex.wad"; + } + + // Hacx hack + + if (gameversion == exe_hacx) + { + return "hacx.wad"; + } + + return D_SaveGameIWADName(gamemission); +} + // // D_DoomMain // @@ -1439,7 +1426,7 @@ void D_DoomMain (void) LoadChexDeh(); LoadHacxDeh(); D_SetGameDescription(); - SetSaveGameDir(iwadfile); + savegamedir = M_GetSaveGameDir(SaveGameIWADName()); // Check for -file in shareware if (modifiedgame) |