From bb4d087d60e3492a0febeec0ef32d6974d839716 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 12 Aug 2021 08:21:52 +0200 Subject: [PATCH] fix resurrect (#2577) --- Source/spells.cpp | 5 +++-- Source/spells.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/spells.cpp b/Source/spells.cpp index e77b5bc5a..f98b63e76 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -249,14 +249,15 @@ void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl) * @param pnum player index * @param rid target player index */ -void DoResurrect(int pnum, int rid) +void DoResurrect(int pnum, uint16_t rid) { if (pnum == MyPlayerId) { NewCursor(CURSOR_HAND); } - if (rid == -1) + if ((DWORD)pnum >= MAX_PLRS || rid >= MAX_PLRS) { return; + } auto &target = Players[rid]; diff --git a/Source/spells.h b/Source/spells.h index 8a6e113e3..43079ddbf 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -21,7 +21,7 @@ void UseMana(int id, spell_id sn); SpellCheckResult CheckSpell(int id, spell_id sn, spell_type st, bool manaonly); void EnsureValidReadiedSpell(PlayerStruct &player); void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl); -void DoResurrect(int pnum, int rid); +void DoResurrect(int pnum, uint16_t rid); void DoHealOther(int pnum, uint16_t rid); int GetSpellBookLevel(spell_id s); int GetSpellStaffLevel(spell_id s);