Browse Source

Clean ups

pull/973/head
Anders Jenbo 5 years ago
parent
commit
c7b32ec4e4
  1. 4
      Source/items.cpp
  2. 2
      Source/missiles.cpp
  3. 6
      Source/monster.cpp
  4. 7
      Source/objects.cpp
  5. 2
      Source/pfile.cpp
  6. 2
      Source/player.cpp

4
Source/items.cpp

@ -2593,7 +2593,7 @@ void GetItemBonus(int i, int idata, int minlvl, int maxlvl, BOOL onlygood)
GetStaffSpell(i, maxlvl, onlygood);
#ifdef HELLFIRE
else
GetItemPower(i, minlvl, maxlvl, 0x100, onlygood);
GetItemPower(i, minlvl, maxlvl, PLT_STAFF, onlygood);
#endif
break;
case ITYPE_RING:
@ -5277,7 +5277,7 @@ void SpawnWitch(int lvl)
j = 3;
#ifdef HELLFIRE
iCnt = random_(51, 15) + 10;
iCnt = random_(51, WITCH_ITEMS - 10) + 10;
int books = random_(3, 4);
#endif

2
Source/missiles.cpp

@ -404,7 +404,7 @@ int GetDirection16(int x1, int y1, int x2, int y2)
my = abs(y2 - y1);
if (my > 15)
my = 15;
md = Dirs[my][mx];
md = Dirs[my][mx]; // BUGFIX, md can be 99, leading to an OOB read
if (x1 > x2) {
if (y1 > y2)
md = urtoll[md];

6
Source/monster.cpp

@ -1868,7 +1868,7 @@ void SpawnLoot(int i, BOOL sendmsg)
CreateMagicWeapon(Monst->_mx, Monst->_my, ITYPE_STAFF, ICURS_WAR_STAFF, FALSE, TRUE);
CreateMagicWeapon(Monst->_mx, Monst->_my, ITYPE_BOW, ICURS_LONG_WAR_BOW, FALSE, TRUE);
CreateSpellBook(Monst->_mx, Monst->_my, SPL_APOCA, FALSE, TRUE);
} else if (i > 3) {
} else if (i > MAX_PLRS - 1) { // Golems should not spawn loot
SpawnItem(i, Monst->_mx, Monst->_my, sendmsg);
}
}
@ -1932,7 +1932,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg)
app_fatal("MonstStartKill: Invalid monster %d", i);
#endif
}
if (!monster[i].MType) {
if (monster[i].MType == NULL) {
#ifdef HELLFIRE
return;
#else
@ -2002,7 +2002,7 @@ void M2MStartKill(int i, int mid)
if ((DWORD)i >= MAXMONSTERS) { /// BUGFIX: should check `mid`
app_fatal("M2MStartKill: Invalid monster (killed) %d", mid);
}
if (!monster[i].MType)
if (monster[i].MType == NULL)
app_fatal("M2MStartKill: Monster %d \"%s\" MType NULL", mid, monster[mid].mName);
delta_kill_monster(mid, monster[mid]._mx, monster[mid]._my, currlevel);

7
Source/objects.cpp

@ -3514,7 +3514,7 @@ void OperateShrine(int pnum, int i, int sType)
DWORD lv, t;
int xx, yy;
int v1, v2, v3, v4;
unsigned __int64 spell;
unsigned __int64 spell, spells;
if (dropGoldFlag) {
dropGoldFlag = FALSE;
@ -3745,8 +3745,13 @@ void OperateShrine(int pnum, int i, int sType)
return;
cnt = 0;
spell = 1;
spells = plr[pnum]._pMemSpells;
for (j = 0; j < MAX_SPELLS; j++) {
#ifdef HELLFIRE
if (spell & plr[pnum]._pMemSpells)
#else
if (spell & spells)
#endif
cnt++;
spell <<= 1;
}

2
Source/pfile.cpp

@ -391,7 +391,7 @@ static char pfile_get_player_class(unsigned int player_class_nr)
return pc_class;
}
static BYTE game_2_ui_class(const PlayerStruct *p) // game_2_ui_class
static BYTE game_2_ui_class(const PlayerStruct *p)
{
BYTE uiclass;
if (p->_pClass == PC_WARRIOR)

2
Source/player.cpp

@ -4387,7 +4387,7 @@ void ModifyPlrStr(int p, int l)
CalcPlrInv(p, TRUE);
if (p == myplr) {
NetSendCmdParam1(FALSE, CMD_SETSTR, plr[p]._pBaseStr); //60
NetSendCmdParam1(FALSE, CMD_SETSTR, plr[p]._pBaseStr);
}
}

Loading…
Cancel
Save