foxygit / doom Log in
commit f804a75c2ea6188254bfe4eb3e0b88913bb61158
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Aug 16 20:57:48 2015 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Aug 16 20:57:48 2015 -0400

    wad: Move W_CheckCorrectIWAD() into w_main.c.

    This seems like a more appropriate place for it.
---
 src/w_main.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
 src/w_main.h |  3 +++
 src/w_wad.c  | 43 -------------------------------------------
 src/w_wad.h  |  4 ----
 4 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/src/w_main.c b/src/w_main.c
index 115f0811..ac67f2dc 100644
--- 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;
@@ -196,3 +197,44 @@ boolean W_ParseCommandLine(void)
     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));
+            }
+        }
+    }
+}
+
diff --git a/src/w_main.h b/src/w_main.h
index 2e39efc3..26b487c8 100644
--- 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 */

diff --git a/src/w_wad.c b/src/w_wad.c
index 567c6cf0..32924dec 100644
--- 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"
@@ -614,44 +612,3 @@ void W_Reload(void)
     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));
-            }
-        }
-    }
-}
-
diff --git a/src/w_wad.h b/src/w_wad.h
index 9587283f..06cf3951 100644
--- 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"


@@ -74,6 +72,4 @@ extern unsigned int W_LumpNameHash(const char *s);
 void W_ReleaseLumpNum(lumpindex_t lump);
 void W_ReleaseLumpName(char *name);

-void W_CheckCorrectIWAD(GameMission_t mission);
-
 #endif