summaryrefslogtreecommitdiff
path: root/src/w_wad.c
diff options
context:
space:
mode:
authorSimon Howard2014-04-19 03:32:38 -0400
committerSimon Howard2014-04-19 03:32:38 -0400
commit48e96443151db631e1153d459e850c49a96ccb29 (patch)
treec6a8df63662657dc92eeb73c0112f1190d3b21a7 /src/w_wad.c
parentb86a383c6fdc394ef995a8e88324c89408f01c05 (diff)
downloadchocolate-doom-48e96443151db631e1153d459e850c49a96ccb29.tar.gz
chocolate-doom-48e96443151db631e1153d459e850c49a96ccb29.tar.bz2
chocolate-doom-48e96443151db631e1153d459e850c49a96ccb29.zip
Exit with error on startup if using the wrong IWAD.
Having multiple binaries can cause some confusion - some users try to run chocolate-doom with hexen.wad, thinking it is supported. Add a startup check that makes sure the user is not trying to start the game using the wrong IWAD file for the binary being run. This fixes #382.
Diffstat (limited to 'src/w_wad.c')
-rw-r--r--src/w_wad.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/w_wad.c b/src/w_wad.c
index 4f944fee..1bb01774 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -34,6 +34,8 @@
#include "doomtype.h"
+#include "config.h"
+#include "d_iwad.h"
#include "i_swap.h"
#include "i_system.h"
#include "i_video.h"
@@ -537,3 +539,44 @@ void W_GenerateHashTable(void)
// All done!
}
+// Lump names that are unique to particular game types. This lets us check
+// the user is not trying to play with the wrong executable, eg.
+// chocolate-doom -iwad hexen.wad.
+static const struct
+{
+ GameMission_t mission;
+ char *lumpname;
+} unique_lumps[] = {
+ { doom, "POSSA1" },
+ { heretic, "IMPXA1" },
+ { hexen, "ETTNA1" },
+ { strife, "AGRDA1" },
+};
+
+void W_CheckCorrectIWAD(GameMission_t mission)
+{
+ int i;
+ int lumpnum;
+
+ for (i = 0; i < arrlen(unique_lumps); ++i)
+ {
+ if (mission != unique_lumps[i].mission)
+ {
+ lumpnum = W_CheckNumForName(unique_lumps[i].lumpname);
+
+ if (lumpnum >= 0)
+ {
+ I_Error("\nYou are trying to use a %s IWAD file with "
+ "the %s%s binary.\nThis isn't going to work.\n"
+ "You probably want to use the %s%s binary.",
+ D_SuggestGameName(unique_lumps[i].mission,
+ indetermined),
+ PROGRAM_PREFIX,
+ D_GameMissionString(mission),
+ PROGRAM_PREFIX,
+ D_GameMissionString(unique_lumps[i].mission));
+ }
+ }
+ }
+}
+