diff --git a/Source/control.cpp b/Source/control.cpp index 4471bac09..a3192021b 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -231,6 +231,8 @@ void DrawSpell() spl = plr[myplr]._pRSpell; st = plr[myplr]._pRSplType; + + // BUGFIX: Move the next line into the if statement to avoid OOB (SPL_INVALID is -1) tlvl = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[spl]; if (st == RSPLTYPE_SPELL && spl != SPL_INVALID) { if (!CheckSpell(myplr, spl, RSPLTYPE_SPELL, TRUE)) diff --git a/Source/monster.cpp b/Source/monster.cpp index eeab1a85a..e3b7da66f 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1215,6 +1215,7 @@ void M_CheckEFlag(int i) } f = 0; + // BUGFIX check (x > 0 && y < MAXDUNY) m = dpiece_defs_map_2[x][y].mt; if (m >= dpiece_defs_map_2[0][0].mt) { for (j = 2; j < 10; j++) { diff --git a/enums.h b/enums.h index a939cd630..c1634a6ec 100644 --- a/enums.h +++ b/enums.h @@ -2158,7 +2158,7 @@ typedef enum spell_id { SPL_HEALOTHER = 0x22, SPL_FLARE = 0x23, SPL_BONESPIRIT = 0x24, - SPL_INVALID = 0xFFFFFFFF, + SPL_INVALID = -1, } spell_id; typedef enum _cmd_id { @@ -2469,7 +2469,7 @@ typedef enum item_misc_id { IMISC_MAPOFDOOM = 0x2A, IMISC_EAR = 0x2B, IMISC_SPECELIX = 0x2C, - IMISC_INVALID = 0xFFFFFFFF, + IMISC_INVALID = -1, } item_misc_id; typedef enum item_type { @@ -2488,7 +2488,7 @@ typedef enum item_type { ITYPE_RING = 0xC, ITYPE_AMULET = 0xD, ITYPE_0E = 0xE, - ITYPE_NONE = 0xFFFFFFFF, + ITYPE_NONE = -1, } item_type; typedef enum _item_indexes { @@ -2557,7 +2557,7 @@ typedef enum quest_id { QTYPE_PW = 0xD, QTYPE_BONE = 0xE, QTYPE_VB = 0xF, - QTYPE_INVALID = 0xFFFFFFFF, + QTYPE_INVALID = -1, } quest_id; typedef enum quest_mush_state {