From 776a3d4e844a8459e282ebdaa03dbd30e75d2b23 Mon Sep 17 00:00:00 2001 From: Juliano Leal Goncalves Date: Sat, 11 Sep 2021 17:59:56 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20'Spell'=20instead=20of=20'?= =?UTF-8?q?RSpell'=20for=20clearing=20used=20inventory=20scrolls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Readied spell can be swapped to something else in between the cast and the hit frame, resulting in incorrect removal. This is how currently belt scrolls are checked so we are now using a consistent strategy. --- Source/inv.cpp | 2 +- test/inv_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/inv.cpp b/Source/inv.cpp index 7d8c30b0a..4007481e4 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1911,7 +1911,7 @@ void RemoveScroll(Player &player) for (int i = 0; i < player._pNumInv; i++) { if (!player.InvList[i].isEmpty() && (player.InvList[i]._iMiscId == IMISC_SCROLL || player.InvList[i]._iMiscId == IMISC_SCROLLT) - && player.InvList[i]._iSpell == player._pRSpell) { + && player.InvList[i]._iSpell == player._pSpell) { player.RemoveInvItem(i); player.CalcScrolls(); return; diff --git a/test/inv_test.cpp b/test/inv_test.cpp index 24f8073b7..70516c44f 100644 --- a/test/inv_test.cpp +++ b/test/inv_test.cpp @@ -198,7 +198,7 @@ TEST(Inv, RemoveScroll_inventory) // Put a firebolt scroll into the inventory Players[MyPlayerId]._pNumInv = 1; - Players[MyPlayerId]._pRSpell = static_cast(SPL_FIREBOLT); + Players[MyPlayerId]._pSpell = static_cast(SPL_FIREBOLT); Players[MyPlayerId].InvList[0]._itype = ITYPE_MISC; Players[MyPlayerId].InvList[0]._iMiscId = IMISC_SCROLL; Players[MyPlayerId].InvList[0]._iSpell = SPL_FIREBOLT;