ref: f804a75c2ea6188254bfe4eb3e0b88913bb61158
parent: a28f2f4333102961668354d75850c7ffebbdb194
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Aug 16 16:57:48 EDT 2015
wad: Move W_CheckCorrectIWAD() into w_main.c. This seems like a more appropriate place for it.
--- a/src/w_main.c
+++ b/src/w_main.c
@@ -16,8 +16,10 @@
// Common code to parse command line, identifying WAD files to load.
//
+#include "config.h"
#include "doomfeatures.h"
#include "d_iwad.h"
+#include "i_system.h"
#include "m_argv.h"
#include "w_main.h"
#include "w_merge.h"
@@ -26,7 +28,6 @@
// Parse the command line, merging WAD files that are sppecified.
// Returns true if at least one file was added.
-
boolean W_ParseCommandLine(void)
{
boolean modifiedgame = false;
@@ -194,5 +195,46 @@
// W_PrintDirectory();
return modifiedgame;
+}
+
+// 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;
+ lumpindex_t 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));
+ }
+ }
+ }
}
--- a/src/w_main.h
+++ b/src/w_main.h
@@ -18,7 +18,10 @@
#ifndef W_MAIN_H
#define W_MAIN_H
+#include "d_mode.h"
+
boolean W_ParseCommandLine(void);
+void W_CheckCorrectIWAD(GameMission_t mission);
#endif /* #ifndef W_MAIN_H */
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -26,8 +26,6 @@
#include "doomtype.h"
-#include "config.h"
-#include "d_iwad.h"
#include "i_swap.h"
#include "i_system.h"
#include "i_video.h"
@@ -612,46 +610,5 @@
// The WAD directory has changed, so we have to regenerate the
// fast lookup hashtable:
W_GenerateHashTable();
-}
-
-// 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;
- lumpindex_t 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));
- }
- }
- }
}
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -23,8 +23,6 @@
#include <stdio.h>
#include "doomtype.h"
-#include "d_mode.h"
-
#include "w_file.h"
@@ -73,7 +71,5 @@
void W_ReleaseLumpNum(lumpindex_t lump);
void W_ReleaseLumpName(char *name);
-
-void W_CheckCorrectIWAD(GameMission_t mission);
#endif