Ensure consistent types for '_pScrlSpells' and '_pISpells' operations

This commit is contained in:
Juliano Goncalves 2020-10-08 16:28:47 -03:00 committed by Anders Jenbo
commit c2ed83eb5e
3 changed files with 8 additions and 12 deletions

View file

@ -908,7 +908,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
// check if the current RSplType is a valid/allowed spell
if (plr[p]._pRSplType == RSPLTYPE_CHARGES
&& !(spl & ((unsigned __int64)1 << (plr[p]._pRSpell - 1)))) {
&& !(spl & (1ULL << (plr[p]._pRSpell - 1)))) {
plr[p]._pRSpell = SPL_INVALID;
plr[p]._pRSplType = RSPLTYPE_INVALID;
force_redraw = 255;
@ -1154,18 +1154,18 @@ void CalcPlrScrolls(int p)
for (i = 0; i < plr[p]._pNumInv; i++) {
if (plr[p].InvList[i]._itype != ITYPE_NONE && (plr[p].InvList[i]._iMiscId == IMISC_SCROLL || plr[p].InvList[i]._iMiscId == IMISC_SCROLLT)) {
if (plr[p].InvList[i]._iStatFlag)
plr[p]._pScrlSpells |= (__int64)1 << (plr[p].InvList[i]._iSpell - 1);
plr[p]._pScrlSpells |= 1ULL << (plr[p].InvList[i]._iSpell - 1);
}
}
for (j = 0; j < MAXBELTITEMS; j++) {
if (plr[p].SpdList[j]._itype != ITYPE_NONE && (plr[p].SpdList[j]._iMiscId == IMISC_SCROLL || plr[p].SpdList[j]._iMiscId == IMISC_SCROLLT)) {
if (plr[p].SpdList[j]._iStatFlag)
plr[p]._pScrlSpells |= (__int64)1 << (plr[p].SpdList[j]._iSpell - 1);
plr[p]._pScrlSpells |= 1ULL << (plr[p].SpdList[j]._iSpell - 1);
}
}
if (plr[p]._pRSplType == RSPLTYPE_SCROLL) {
if (!(plr[p]._pScrlSpells & 1 << (plr[p]._pRSpell - 1))) {
if (!(plr[p]._pScrlSpells & 1ULL << (plr[p]._pRSpell - 1))) {
plr[p]._pRSpell = SPL_INVALID;
plr[p]._pRSplType = RSPLTYPE_INVALID;
force_redraw = 255;