diff --git a/source/duke3d/src/cheats.cpp b/source/duke3d/src/cheats.cpp index ebb5cffb2..d27a36d95 100644 --- a/source/duke3d/src/cheats.cpp +++ b/source/duke3d/src/cheats.cpp @@ -314,9 +314,7 @@ void G_DoCheats(void) FOUNDCHEAT:; - int i = VM_OnEventWithReturn(EVENT_ACTIVATECHEAT, pPlayer->i, myconnectindex, cheatNum); - if (cheatNum != CHEAT_COMEGETSOME) // Users are not allowed to interfere with TX's debugging cheat. - cheatNum = i; + cheatNum = VM_OnEventWithReturn(EVENT_ACTIVATECHEAT, pPlayer->i, myconnectindex, cheatNum); { switch (cheatNum) @@ -468,7 +466,7 @@ void G_DoCheats(void) case CHEAT_SKILL: if (cheatNum == CHEAT_SCOTTY) { - i = Bstrlen(CheatStrings[cheatNum])-3+VOLUMEONE; + size_t const i = Bstrlen(CheatStrings[cheatNum])-3+VOLUMEONE; if (!consoleCheat) { // JBF 20030914 @@ -508,7 +506,7 @@ void G_DoCheats(void) { if (!consoleCheat) { - i = Bstrlen(CheatStrings[cheatNum])-1; + size_t const i = Bstrlen(CheatStrings[cheatNum])-1; ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; } else @@ -548,7 +546,7 @@ void G_DoCheats(void) case CHEAT_UNLOCK: if (VOLUMEONE) return; - for (i=numsectors-1; i>=0; i--) //Unlock + for (bssize_t i=numsectors-1; i>=0; i--) //Unlock { int const lotag = sector[i].lotag; if (lotag == -1 || lotag == 32767) continue; @@ -581,7 +579,7 @@ void G_DoCheats(void) case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; ud.showallmap = !ud.showallmap; - for (i=0; i<(MAXSECTORS>>3); i++) + for (bssize_t i=0; i<(MAXSECTORS>>3); i++) show2dsector[i] = ud.showallmap*255; P_DoQuote(ud.showallmap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF, diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 3f5ce406f..c4242c164 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegame.h" #include "common.h" #include "common_game.h" +#include "cheats.h" #include "osd.h" @@ -5798,7 +5799,7 @@ repeatcase: C_GetNextValue(LABEL_DEFINE); k = *(g_scriptPtr-1); - if (EDUKE32_PREDICT_FALSE(k > 25)) + if (EDUKE32_PREDICT_FALSE((unsigned)k >= NUMCHEATS)) { initprintf("%s:%d: error: cheat redefinition attempts to redefine nonexistent cheat.\n",g_scriptFileName,g_lineNumber); g_errorCnt++;