summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/d_iwad.c24
2 files changed, 14 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index e2d95b7d..425da376 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
* Fixed gnome-screensaver desktop file (thanks Rahul Sundaram).
* Updated COPYING to current version of GPL2 (thanks Rahul
Sundaram).
+ * Fix bug with detection of IWAD type by filename (thanks mether).
1.6.0 (2011-05-17):
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;