diff --git a/Source/lua/modules/dev/towners.cpp b/Source/lua/modules/dev/towners.cpp index 4d9784688..87610258b 100644 --- a/Source/lua/modules/dev/towners.cpp +++ b/Source/lua/modules/dev/towners.cpp @@ -62,7 +62,7 @@ std::string DebugCmdVisitTowner(std::string_view name) for (const Towner &towner : Towners) { if (towner._ttype != it->second) continue; CastSpell( - static_cast(MyPlayerId), + *MyPlayer, SpellID::Teleport, myPlayer.position.tile, towner.position, diff --git a/Source/player.cpp b/Source/player.cpp index ee51fca10..e6c2b7b95 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1044,7 +1044,7 @@ bool DoSpell(Player &player) { if (player.AnimInfo.currentFrame == player._pSFNum) { CastSpell( - player.getId(), + player, player.executedSpell.spellId, player.position.tile, player.position.temp, diff --git a/Source/spells.cpp b/Source/spells.cpp index c5b1e9d11..795ea66ef 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -209,9 +209,8 @@ SpellCheckResult CheckSpell(const Player &player, SpellID sn, SpellType st, bool return SpellCheckResult::Success; } -void CastSpell(int id, SpellID spl, WorldTilePosition src, WorldTilePosition dst, int spllvl) +void CastSpell(Player &player, SpellID spl, WorldTilePosition src, WorldTilePosition dst, int spllvl) { - Player &player = Players[id]; Direction dir = player._pdir; if (IsWallSpell(spl)) { dir = player.tempDirection; diff --git a/Source/spells.h b/Source/spells.h index 0ce5e8402..81064f9a6 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -35,7 +35,7 @@ SpellCheckResult CheckSpell(const Player &player, SpellID sn, SpellType st, bool * @param player The player whose readied spell is to be checked. */ void EnsureValidReadiedSpell(Player &player); -void CastSpell(int id, SpellID spl, WorldTilePosition src, WorldTilePosition dst, int spllvl); +void CastSpell(Player &player, SpellID spl, WorldTilePosition src, WorldTilePosition dst, int spllvl); /** * @param pnum player index