Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Player struct variables: _pScrlSpells #7288

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/controls/modifier_hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void LoadPlayer(LoadHelper &file, Player &player)
file.Skip(7); // Alignment
player._pMemSpells = file.NextLE<uint64_t>();
player._pAblSpells = file.NextLE<uint64_t>();
player._pScrlSpells = file.NextLE<uint64_t>();
player.scrollSpells = file.NextLE<uint64_t>();
player._pSpellFlags = static_cast<SpellFlag>(file.NextLE<uint8_t>());
file.Skip(3); // Alignment

Expand Down Expand Up @@ -1234,7 +1234,7 @@ void SavePlayer(SaveHelper &file, const Player &player)
file.Skip(7); // Alignment
file.WriteLE<uint64_t>(player._pMemSpells);
file.WriteLE<uint64_t>(player._pAblSpells);
file.WriteLE<uint64_t>(player._pScrlSpells);
file.WriteLE<uint64_t>(player.scrollSpells);
file.WriteLE<uint8_t>(static_cast<uint8_t>(player._pSpellFlags));
file.Skip(3); // Alignment

Expand Down
6 changes: 3 additions & 3 deletions Source/panels/spell_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ std::vector<SpellListItem> GetSpellListItems()
mask = myPlayer._pMemSpells;
break;
case SpellType::Scroll:
mask = myPlayer._pScrlSpells;
mask = myPlayer.scrollSpells;
break;
case SpellType::Charges:
mask = myPlayer._pISpells;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Source/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion Source/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/memory_map/player.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/player_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/writehero_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading