ref: 7f49b3a99fe81f817f9de03da63b69531264b8f7
parent: 89b2315275de48ee66241e883b6e7d8695af3c75
parent: 87d96c2ddf74afe0466e07477f424d6ffacafc9c
author: Simon Howard <[email protected]>
date: Sun Feb 10 07:41:38 EST 2019
Merge pull request #1136 from turol/const Const correctness fixes in Strife
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -757,7 +757,7 @@
// These are from the original source: some of them are perhaps
// not used in any dehacked patches
-static char *banners[] =
+static const char *banners[] =
{
// strife1.wad:
@@ -957,7 +957,7 @@
// Some dehacked mods replace these. These are only displayed if they are
// replaced by dehacked.
// haleyjd 08/22/2010: [STRIFE] altered to match strings from binary
-static char *copyright_banners[] =
+static const char *copyright_banners[] =
{
"===========================================================================\n"
"ATTENTION: This version of STRIFE has extra files added to it.\n"
@@ -1003,8 +1003,8 @@
static struct
{
- char *description;
- char *cmdline;
+ const char *description;
+ const char *cmdline;
GameVersion_t version;
} gameversions[] = {
{ "Strife 1.2", "1.2", exe_strife_1_2 },
@@ -1145,7 +1145,7 @@
//
// D_DrawText
//
-static void D_DrawText(char *string, int bc, int fc)
+static void D_DrawText(const char *string, int bc, int fc)
{
int column;
int row;
--- a/src/strife/deh_cheat.c
+++ b/src/strife/deh_cheat.c
@@ -28,7 +28,7 @@
typedef struct
{
- char *name;
+ const char *name;
cheatseq_t *seq;
} deh_cheat_t;
--- a/src/strife/deh_misc.c
+++ b/src/strife/deh_misc.c
@@ -132,7 +132,7 @@
static struct
{
- char *deh_name;
+ const char *deh_name;
int *value;
} misc_settings[] = {
{"Initial Health", &deh_initial_health},
--- a/src/strife/doomstat.c
+++ b/src/strife/doomstat.c
@@ -25,7 +25,7 @@
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
GameVersion_t gameversion = exe_strife_1_31;
-char *gamedescription;
+const char *gamedescription;
// Set if homebrew PWAD stuff has been added.
boolean modifiedgame;
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -58,7 +58,7 @@
extern GameMode_t gamemode;
extern GameMission_t gamemission;
extern GameVersion_t gameversion;
-extern char *gamedescription;
+extern const char *gamedescription;
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;
@@ -243,7 +243,6 @@
// File handling stuff.
extern char * savegamedir;
-extern char basedefault[1024];
// if true, load all graphics at level load
extern boolean precache;
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -2274,7 +2274,7 @@
// Generate a string describing a demo version
// [STRIFE] Modified to handle the one and only Strife demo version.
-static char *DemoVersionDescription(int version)
+static const char *DemoVersionDescription(int version)
{
static char resultbuf[16];
@@ -2326,14 +2326,14 @@
*/
else
{
- char *message = "Demo is from a different game version!\n"
- "(read %i, should be %i)\n"
- "\n"
- "*** You may need to upgrade your version "
- "of Strife to v1.1 or later. ***\n"
- " See: https://www.doomworld.com/classicdoom"
- "/info/patches.php\n"
- " This appears to be %s.";
+ const char *message = "Demo is from a different game version!\n"
+ "(read %i, should be %i)\n"
+ "\n"
+ "*** You may need to upgrade your version "
+ "of Strife to v1.1 or later. ***\n"
+ " See: https://www.doomworld.com/classicdoom"
+ "/info/patches.php\n"
+ " This appears to be %s.";
I_Error(message, demoversion, STRIFE_VERSION,
DemoVersionDescription(demoversion));
--- a/src/strife/hu_lib.c
+++ b/src/strife/hu_lib.c
@@ -41,10 +41,10 @@
//
// haleyjd 20100918: [STRIFE] New function.
//
-void HUlib_drawYellowText(int x, int y, char *text)
+void HUlib_drawYellowText(int x, int y, const char *text)
{
int start_x = x;
- char *rover = text;
+ const char *rover = text;
char c;
while((c = *rover++))
--- a/src/strife/hu_lib.h
+++ b/src/strife/hu_lib.h
@@ -112,7 +112,7 @@
void HUlib_eraseTextLine(hu_textline_t *l);
// villsa [STRIFE]
-void HUlib_drawYellowText(int x, int y, char *text);
+void HUlib_drawYellowText(int x, int y, const char *text);
//
--- a/src/strife/hu_stuff.c
+++ b/src/strife/hu_stuff.c
@@ -121,7 +121,7 @@
// haleyjd 08/31/10: [STRIFE] Changed for Strife level names.
// List of names for levels.
-char *mapnames[] =
+const char *mapnames[] =
{
// Strife map names
--- a/src/strife/hu_stuff.h
+++ b/src/strife/hu_stuff.h
@@ -59,7 +59,7 @@
extern char player_names[8][16]; // villsa [STRIFE]
// haleyjd [STRIFE] externalized:
-extern char *mapnames[];
+extern const char *mapnames[];
// [STRIFE]
extern patch_t* yfont[HU_FONTSIZE]; // haleyjd 09/18/10: [STRIFE]
--- a/src/strife/info.c
+++ b/src/strife/info.c
@@ -30,7 +30,7 @@
#include "p_mobj.h"
// villsa [STRIFE]
-char *sprnames[NUMSPRITES+1] =
+const char *sprnames[NUMSPRITES+1] =
{
"PLAY", "PNCH", "WAVE", "RBPY", "TRGT", "XBOW", "MMIS", "RIFG",
"RIFF", "FLMT", "FLMF", "BLST", "BLSF", "GREN", "GREF", "SIGH",
--- a/src/strife/info.h
+++ b/src/strife/info.h
@@ -1833,7 +1833,7 @@
} state_t;
extern state_t states[NUMSTATES];
-extern char *sprnames[];
+extern const char *sprnames[];
typedef enum
{
@@ -2211,7 +2211,7 @@
int damage;
int activesound;
int flags;
- char* name;
+ const char *name;
} mobjinfo_t;
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -146,8 +146,8 @@
// graphic name of cursors
// haleyjd 08/27/10: [STRIFE] M_SKULL* -> M_CURS*
-char *cursorName[8] = {"M_CURS1", "M_CURS2", "M_CURS3", "M_CURS4",
- "M_CURS5", "M_CURS6", "M_CURS7", "M_CURS8" };
+const char *cursorName[8] = {"M_CURS1", "M_CURS2", "M_CURS3", "M_CURS4",
+ "M_CURS5", "M_CURS6", "M_CURS7", "M_CURS8" };
// haleyjd 20110210 [STRIFE]: skill level for menus
int menuskill;
--- a/src/strife/p_dialog.c
+++ b/src/strife/p_dialog.c
@@ -158,7 +158,7 @@
{
const char *type_name;
int nummessages;
- char *messages[MAXRNDMESSAGES];
+ const char *messages[MAXRNDMESSAGES];
} rndmessage_t;
static rndmessage_t rndMessages[] =
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -92,7 +92,7 @@
// haleyjd 08/30/10: [STRIFE] Needed externally
void P_Thrust (player_t* player, angle_t angle, fixed_t move);
// villsa [STRIFE]
-char* P_RemoveInventoryItem(player_t *player, int slot, int amount);
+const char *P_RemoveInventoryItem(player_t *player, int slot, int amount);
//
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -196,7 +196,7 @@
// villsa [STRIFE] terrain type definitions
typedef struct
{
- char* flat;
+ const char *flat;
int type;
int num;
} terraintype_t;
--- a/src/strife/p_user.c
+++ b/src/strife/p_user.c
@@ -595,7 +595,7 @@
// P_RemoveInventoryItem
// villsa [STRIFE] new function
//
-char* P_RemoveInventoryItem(player_t *player, int slot, int amount)
+const char* P_RemoveInventoryItem(player_t *player, int slot, int amount)
{
mobjtype_t type;
@@ -841,7 +841,7 @@
boolean P_UseInventoryItem(player_t* player, int item)
{
int i;
- char* name;
+ const char *name;
if(player->cheats & CF_ONFIRE)
return false;
--- a/src/strife/r_things.c
+++ b/src/strife/r_things.c
@@ -171,9 +171,9 @@
// letter/number appended.
// The rotation character can be 0 to signify no rotations.
//
-void R_InitSpriteDefs (char** namelist)
+void R_InitSpriteDefs (const char** namelist)
{
- char** check;
+ const char **check;
int i;
int l;
int frame;
@@ -292,7 +292,7 @@
// R_InitSprites
// Called at program start.
//
-void R_InitSprites (char** namelist)
+void R_InitSprites (const char** namelist)
{
int i;
--- a/src/strife/r_things.h
+++ b/src/strife/r_things.h
@@ -52,7 +52,7 @@
void R_AddSprites (sector_t* sec);
void R_AddPSprites (void);
void R_DrawSprites (void);
-void R_InitSprites (char** namelist);
+void R_InitSprites (const char** namelist);
void R_ClearSprites (void);
void R_DrawMasked (void);
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -201,7 +201,7 @@
static patch_t* invarmor[2]; // armor icons
// names for ammo patches
-static char *invammonames[NUMAMMO] =
+static const char *invammonames[NUMAMMO] =
{
"I_BLIT",
"I_XQRL",