summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-08-29 20:37:26 +0000
committerSimon Howard2011-08-29 20:37:26 +0000
commit358db83778b46427fe267f86532d3a84d25a50ac (patch)
tree1442ff63be6005c271449b8bc412ce87243fbbc1 /src
parent2e67fde263924a1f3f3b792dbd38bd58b7a3b948 (diff)
downloadchocolate-doom-358db83778b46427fe267f86532d3a84d25a50ac.tar.gz
chocolate-doom-358db83778b46427fe267f86532d3a84d25a50ac.tar.bz2
chocolate-doom-358db83778b46427fe267f86532d3a84d25a50ac.zip
Fix bug with detection of IWAD type by filename (thanks mether).
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2359
Diffstat (limited to 'src')
-rw-r--r--src/d_iwad.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c
index c0d33707..be5a3880 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -430,22 +430,24 @@ static char *SearchDirectoryForIWAD(char *dir)
static void IdentifyIWADByName(char *name)
{
size_t i;
+ char *p;
- gamemission = none;
-
- for (i=0; i<arrlen(iwads); ++i)
- {
- char *iwadname;
+ // Trim down the name to just the filename, ignoring the path.
- iwadname = DEH_String(iwads[i].name);
+ p = strrchr(name, DIR_SEPARATOR);
- if (strlen(name) < strlen(iwadname))
- continue;
+ if (p != NULL)
+ {
+ name = p + 1;
+ }
+
+ gamemission = none;
- // Check if it ends in this IWAD name.
+ for (i=0; i<arrlen(iwads); ++i)
+ {
+ // Check if the filename is this IWAD name.
- if (!strcasecmp(name + strlen(name) - strlen(iwadname),
- iwadname))
+ if (!strcasecmp(name, DEH_String(iwads[i].name)))
{
CheckSpecialIWADs(iwads[i].name);
gamemission = iwads[i].mission;