From 0da09df7d6f277d36b4123abc6d24195d7fb0939 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 22 Feb 2021 05:01:34 +0100 Subject: [PATCH] Fix a few compiler warnings --- Source/diablo.cpp | 12 +++++++----- Source/objdat.cpp | 8 ++++---- Source/objdat.h | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 06ae29011..6654aa4a9 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1168,15 +1168,17 @@ static void PressChar(WPARAM vkey) AutomapZoomOut(); } return; - case 'v': - char *difficulties[3]; + case 'v': { char pszStr[120]; - difficulties[0] = "Normal"; - difficulties[1] = "Nightmare"; - difficulties[2] = "Hell"; + const char *difficulties[3] = { + "Normal", + "Nightmare", + "Hell", + }; sprintf(pszStr, "%s, mode = %s", gszProductName, difficulties[gnDifficulty]); NetSendCmdString(1 << myplr, pszStr); return; + } case 'V': NetSendCmdString(1 << myplr, gszVersionNumber); return; diff --git a/Source/objdat.cpp b/Source/objdat.cpp index 92b3fcd25..49d9fcb1e 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -8,7 +8,7 @@ DEVILUTION_BEGIN_NAMESPACE /** Maps from dun_object_id to object_id. */ -int ObjTypeConv[] = { +const int ObjTypeConv[] = { 0, OBJ_LEVER, OBJ_CRUX1, @@ -151,7 +151,7 @@ int ObjTypeConv[] = { }; /** Contains the data related to each object ID. */ -ObjDataStruct AllObjects[] = { +const ObjDataStruct AllObjects[] = { // clang-format off // oload, ofindex, ominlvl, omaxlvl, olvltype, otheme, oquest, oAnimFlag, oAnimDelay, oAnimLen, oAnimWidth, oSolidFlag, oMissFlag, oLightFlag, oBreak, oSelFlag, oTrapFlag { 1, OFILE_L1BRAZ, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 1, 1, 26, 64, TRUE, TRUE, FALSE, 0, 0, FALSE }, @@ -317,7 +317,7 @@ const char *const ObjMasterLoadList[] = { "LzStand" }; /** Maps from object_graphic_id to object CEL name (Hellfire Crypt overwrite). */ -char *ObjCryptLoadList[] = { +const char *ObjCryptLoadList[] = { "L1Braz", "L5Door", "L5Lever", @@ -376,7 +376,7 @@ char *ObjCryptLoadList[] = { "LzStand", }; /** Maps from object_graphic_id to object CEL name (Hellfire Hive overwrite). */ -char *ObjHiveLoadList[] = { +const char *ObjHiveLoadList[] = { "L1Braz", "L1Doors", "Lever", diff --git a/Source/objdat.h b/Source/objdat.h index ad216a82a..40f38df19 100644 --- a/Source/objdat.h +++ b/Source/objdat.h @@ -12,11 +12,11 @@ DEVILUTION_BEGIN_NAMESPACE extern "C" { #endif -extern int ObjTypeConv[]; -extern ObjDataStruct AllObjects[]; +extern const int ObjTypeConv[]; +extern const ObjDataStruct AllObjects[]; extern const char *const ObjMasterLoadList[]; -extern char *ObjCryptLoadList[]; -extern char *ObjHiveLoadList[]; +extern const char *ObjCryptLoadList[]; +extern const char *ObjHiveLoadList[]; #ifdef __cplusplus }