commit 7742f0d45950980423839c7145f6dc70f6daa63b
Author: James Haley <haleyjd@hotmail.com>
AuthorDate: Sat May 21 13:57:58 2016 -0500
Commit: James Haley <haleyjd@hotmail.com>
CommitDate: Sat May 21 13:57:58 2016 -0500
Swap order of checks for voices.wad; resolve issue #675
---
src/strife/d_main.c | 65 ++++++++++++++++++++++++++---------------------------
1 file changed, 32 insertions(+), 33 deletions(-)
diff --git a/src/strife/d_main.c b/src/strife/d_main.c
index 984d460b..ddfbd7a9 100644
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -830,49 +830,48 @@ void D_IdentifyVersion(void)
// Load voices.wad
if(isregistered)
{
- char *name = D_FindWADByName("voices.wad");
+ char *name = NULL;
+ int p;
- if(!name) // not found?
+ // If -iwad was used, check and see if voices.wad exists on the same
+ // filepath.
+ if((p = M_CheckParm("-iwad")) && p < myargc - 1)
{
- int p;
+ char *iwad = myargv[p + 1];
+ size_t len = strlen(iwad) + 1;
+ char *iwadpath = Z_Malloc(len, PU_STATIC, NULL);
+ char *voiceswad;
- // haleyjd STRIFE-FIXME: Temporary?
- // If -iwad was used, check and see if voices.wad exists on the
- // same filepath.
- if((p = M_CheckParm("-iwad")) && p < myargc - 1)
- {
- char *iwad = myargv[p + 1];
- size_t len = strlen(iwad) + 1;
- char *iwadpath = Z_Malloc(len, PU_STATIC, NULL);
- char *voiceswad;
-
- // extract base path of IWAD parameter
- M_GetFilePath(iwad, iwadpath, len);
-
- // concatenate with /voices.wad
- voiceswad = M_SafeFilePath(iwadpath, "voices.wad");
- Z_Free(iwadpath);
-
- if(!M_FileExists(voiceswad))
- {
- disable_voices = 1;
- Z_Free(voiceswad);
- }
- else
- name = voiceswad; // STRIFE-FIXME: memory leak!!
- }
+ // extract base path of IWAD parameter
+ M_GetFilePath(iwad, iwadpath, len);
+
+ // concatenate with /voices.wad
+ voiceswad = M_SafeFilePath(iwadpath, "voices.wad");
+ Z_Free(iwadpath);
+
+ if(!M_FileExists(voiceswad))
+ Z_Free(voiceswad);
else
- disable_voices = 1;
+ name = voiceswad; // STRIFE-FIXME: memory leak!!
}
- if(disable_voices) // voices disabled?
+ // not found? try global search paths
+ if(!name)
+ name = D_FindWADByName("voices.wad");
+
+ // still not found? too bad.
+ if(!name)
{
+ disable_voices = 1;
+
if(devparm)
printf("Voices disabled\n");
- return;
}
-
- D_AddFile(name);
+ else
+ {
+ // add it.
+ D_AddFile(name);
+ }
}
}