diff --git a/Source/controls/modifier_hints.cpp b/Source/controls/modifier_hints.cpp index 455a00eb422..856c75e4f1b 100644 --- a/Source/controls/modifier_hints.cpp +++ b/Source/controls/modifier_hints.cpp @@ -119,7 +119,7 @@ void DrawSpellsCircleMenuHint(const Surface &out, const Point &origin) hintBoxPositions[2] + spellIconDisplacement, hintBoxPositions[3] + spellIconDisplacement, }; - uint64_t spells = myPlayer._pAblSpells | myPlayer._pMemSpells | myPlayer._pScrlSpells | myPlayer._pISpells; + uint64_t spells = myPlayer._pAblSpells | myPlayer._pMemSpells | myPlayer.scrollSpells | myPlayer._pISpells; SpellID splId; SpellType splType; diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 0c0dd1533ad..7f63b4709d3 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -411,7 +411,7 @@ void LoadPlayer(LoadHelper &file, Player &player) file.Skip(7); // Alignment player._pMemSpells = file.NextLE(); player._pAblSpells = file.NextLE(); - player._pScrlSpells = file.NextLE(); + player.scrollSpells = file.NextLE(); player._pSpellFlags = static_cast(file.NextLE()); file.Skip(3); // Alignment @@ -1234,7 +1234,7 @@ void SavePlayer(SaveHelper &file, const Player &player) file.Skip(7); // Alignment file.WriteLE(player._pMemSpells); file.WriteLE(player._pAblSpells); - file.WriteLE(player._pScrlSpells); + file.WriteLE(player.scrollSpells); file.WriteLE(static_cast(player._pSpellFlags)); file.Skip(3); // Alignment diff --git a/Source/panels/spell_list.cpp b/Source/panels/spell_list.cpp index 26da82c5452..c824b184f30 100644 --- a/Source/panels/spell_list.cpp +++ b/Source/panels/spell_list.cpp @@ -215,7 +215,7 @@ std::vector GetSpellListItems() mask = myPlayer._pMemSpells; break; case SpellType::Scroll: - mask = myPlayer._pScrlSpells; + mask = myPlayer.scrollSpells; break; case SpellType::Charges: mask = myPlayer._pISpells; @@ -308,7 +308,7 @@ bool IsValidSpeedSpell(size_t slot) spells = myPlayer._pMemSpells; break; case SpellType::Scroll: - spells = myPlayer._pScrlSpells; + spells = myPlayer.scrollSpells; break; case SpellType::Charges: spells = myPlayer._pISpells; @@ -352,7 +352,7 @@ void DoSpeedBook() spells = myPlayer._pMemSpells; break; case SpellType::Scroll: - spells = myPlayer._pScrlSpells; + spells = myPlayer.scrollSpells; break; case SpellType::Charges: spells = myPlayer._pISpells; diff --git a/Source/player.cpp b/Source/player.cpp index 7f21af54eff..a176865e42d 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1558,10 +1558,10 @@ uint16_t GetPlayerSpriteWidth(HeroClass cls, player_graphic graphic, PlayerWeapo void Player::CalcScrolls() { - _pScrlSpells = 0; + scrollSpells = 0; for (Item &item : InventoryAndBeltPlayerItemsRange { *this }) { if (item.isScroll() && item._iStatFlag) { - _pScrlSpells |= GetSpellBitmask(item._iSpell); + scrollSpells |= GetSpellBitmask(item._iSpell); } } EnsureValidReadiedSpell(*this); diff --git a/Source/player.h b/Source/player.h index a6c392c5413..0927217dd39 100644 --- a/Source/player.h +++ b/Source/player.h @@ -332,8 +332,8 @@ struct Player { uint64_t _pMemSpells; /** @brief Bitmask of abilities */ uint64_t _pAblSpells; - /** @brief Bitmask of spells available via scrolls */ - uint64_t _pScrlSpells; + /** @brief Bitmask of spells available via scrolls (_pScrlSpells) */ + uint64_t scrollSpells; SpellFlag _pSpellFlags; SpellID _pSplHotKey[NumHotkeys]; SpellType _pSplTHotKey[NumHotkeys]; diff --git a/Source/spells.cpp b/Source/spells.cpp index 795ea66ef5b..c47a2d2f243 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -41,7 +41,7 @@ bool IsReadiedSpellValid(const Player &player) return (player._pISpells & GetSpellBitmask(player._pRSpell)) != 0; case SpellType::Scroll: - return (player._pScrlSpells & GetSpellBitmask(player._pRSpell)) != 0; + return (player.scrollSpells & GetSpellBitmask(player._pRSpell)) != 0; default: return false; diff --git a/test/fixtures/memory_map/player.txt b/test/fixtures/memory_map/player.txt index 3707e38f8f1..ca522aee4ea 100644 --- a/test/fixtures/memory_map/player.txt +++ b/test/fixtures/memory_map/player.txt @@ -51,7 +51,7 @@ M 64 8 spellLevel R 56 alignment R 64 _pMemSpells R 64 _pAblSpells -R 64 _pScrlSpells +R 64 scrollSpells R 8 _pSpellFlags R 24 alignment M 4 32 _pSplHotKey diff --git a/test/player_test.cpp b/test/player_test.cpp index 40dec523fac..19d289d4bae 100644 --- a/test/player_test.cpp +++ b/test/player_test.cpp @@ -145,7 +145,7 @@ static void AssertPlayer(Player &player) ASSERT_EQ(player._pRSplType, SpellType::Skill); ASSERT_EQ(player._pSBkSpell, SpellID::Null); ASSERT_EQ(player._pAblSpells, 134217728); - ASSERT_EQ(player._pScrlSpells, 0); + ASSERT_EQ(player.scrollSpells, 0); ASSERT_EQ(player._pSpellFlags, SpellFlag::None); ASSERT_EQ(player._pBlockFlag, 0); ASSERT_EQ(player._pLightRad, 10); diff --git a/test/writehero_test.cpp b/test/writehero_test.cpp index adef0be6db6..e90f52ec07e 100644 --- a/test/writehero_test.cpp +++ b/test/writehero_test.cpp @@ -316,7 +316,7 @@ void AssertPlayer(Player &player) ASSERT_EQ(player._pRSplType, SpellType::Invalid); ASSERT_EQ(player._pSBkSpell, SpellID::Invalid); ASSERT_EQ(player._pAblSpells, 134217728); - ASSERT_EQ(player._pScrlSpells, 0); + ASSERT_EQ(player.scrollSpells, 0); ASSERT_EQ(player._pSpellFlags, SpellFlag::None); ASSERT_TRUE(player.UsesRangedWeapon()); ASSERT_EQ(player._pBlockFlag, 0);