foxygit / doom Log in
commit 7d238f61488d550b5bfbe5075b923723bb5d0cfb
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Apr 19 03:39:55 2014 -0400
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Apr 19 03:39:55 2014 -0400

    setup: Make iwad_t pointers const.

    The table of IWAD data is stored in const memory, so make all iwad_t
    pointers const to fix compiler warnings.
---
 src/setup/mode.c        |  6 +++---
 src/setup/mode.h        |  2 +-
 src/setup/multiplayer.c | 20 ++++++++++----------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/setup/mode.c b/src/setup/mode.c
index 1ad68bd1..bc82c3d4 100644
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -47,7 +47,7 @@
 #include "mode.h"

 GameMission_t gamemission;
-static iwad_t **iwads;
+static const iwad_t **iwads;

 typedef struct
 {
@@ -280,7 +280,7 @@ static void OpenGameSelectDialog(GameSelectCallback callback)
 {
     mission_config_t *mission = NULL;
     txt_window_t *window;
-    iwad_t **iwads;
+    const iwad_t **iwads;
     int num_games;
     int i;

@@ -380,7 +380,7 @@ char *GetGameTitle(void)
     return game_title;
 }

-iwad_t **GetIwads(void)
+const iwad_t **GetIwads(void)
 {
     return iwads;
 }
diff --git a/src/setup/mode.h b/src/setup/mode.h
index 2495775d..624abbfc 100644
--- a/src/setup/mode.h
+++ b/src/setup/mode.h
@@ -32,7 +32,7 @@ void SetupMission(GameSelectCallback callback);
 void InitBindings(void);
 char *GetExecutableName(void);
 char *GetGameTitle(void);
-iwad_t **GetIwads(void);
+const iwad_t **GetIwads(void);

 #endif /* #ifndef SETUP_MODE_H */

diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c
index 8b461066..54a329d8 100644
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -52,7 +52,7 @@ typedef enum

 // Fallback IWADs to use if no IWADs are detected.

-static iwad_t fallback_iwads[] = {
+static const iwad_t fallback_iwads[] = {
     { "doom.wad",     doom,     registered,  "Doom" },
     { "heretic.wad",  heretic,  retail,      "Heretic" },
     { "hexen.wad",    hexen,    commercial,  "Hexen" },
@@ -61,7 +61,7 @@ static iwad_t fallback_iwads[] = {

 // Array of IWADs found to be installed

-static iwad_t **found_iwads;
+static const iwad_t **found_iwads;
 static char *iwad_labels[8];

 // Index of the currently selected IWAD
@@ -153,14 +153,14 @@ static int query_servers_found;

 // Find an IWAD from its description

-static iwad_t *GetCurrentIWAD(void)
+static const iwad_t *GetCurrentIWAD(void)
 {
     return found_iwads[found_iwad_selected];
 }

 // Is the currently selected IWAD the Chex Quest chex.wad?

-static boolean IsChexQuest(iwad_t *iwad)
+static boolean IsChexQuest(const iwad_t *iwad)
 {
     return !strcmp(iwad->name, "chex.wad");
 }
@@ -320,7 +320,7 @@ static void UpdateWarpButton(void)

 static void UpdateSkillButton(void)
 {
-    iwad_t *iwad = GetCurrentIWAD();
+    const iwad_t *iwad = GetCurrentIWAD();

     if (IsChexQuest(iwad))
     {
@@ -393,7 +393,7 @@ static void LevelSelectDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data))
     txt_window_t *window;
     txt_table_t *table;
     txt_button_t *button;
-    iwad_t *iwad;
+    const iwad_t *iwad;
     char buf[10];
     int episodes;
     int x, y;
@@ -477,7 +477,7 @@ static void LevelSelectDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data))

 static void IWADSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 {
-    iwad_t *iwad;
+    const iwad_t *iwad;

     // Find the iwad_t selected

@@ -493,7 +493,7 @@ static void IWADSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 {
     warptype_t new_warptype;
-    iwad_t *iwad;
+    const iwad_t *iwad;

     // Get the selected IWAD

@@ -527,9 +527,9 @@ static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 // Get an IWAD list with a default fallback IWAD that is appropriate
 // for the game we are configuring (matches gamemission global variable).

-static iwad_t **GetFallbackIwadList(void)
+static const iwad_t **GetFallbackIwadList(void)
 {
-    static iwad_t *fallback_iwad_list[2];
+    static const iwad_t *fallback_iwad_list[2];
     unsigned int i;

     // Default to use if we don't find something better.