Browse Source

Change CastSpell to Player reference

pull/6846/head
obligaron 2 years ago committed by Gleb Mazovetskiy
parent
commit
f445bb4ef8
  1. 2
      Source/lua/modules/dev/towners.cpp
  2. 2
      Source/player.cpp
  3. 3
      Source/spells.cpp
  4. 2
      Source/spells.h

2
Source/lua/modules/dev/towners.cpp

@ -62,7 +62,7 @@ std::string DebugCmdVisitTowner(std::string_view name)
for (const Towner &towner : Towners) { for (const Towner &towner : Towners) {
if (towner._ttype != it->second) continue; if (towner._ttype != it->second) continue;
CastSpell( CastSpell(
static_cast<int>(MyPlayerId), *MyPlayer,
SpellID::Teleport, SpellID::Teleport,
myPlayer.position.tile, myPlayer.position.tile,
towner.position, towner.position,

2
Source/player.cpp

@ -1044,7 +1044,7 @@ bool DoSpell(Player &player)
{ {
if (player.AnimInfo.currentFrame == player._pSFNum) { if (player.AnimInfo.currentFrame == player._pSFNum) {
CastSpell( CastSpell(
player.getId(), player,
player.executedSpell.spellId, player.executedSpell.spellId,
player.position.tile, player.position.tile,
player.position.temp, player.position.temp,

3
Source/spells.cpp

@ -209,9 +209,8 @@ SpellCheckResult CheckSpell(const Player &player, SpellID sn, SpellType st, bool
return SpellCheckResult::Success; 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; Direction dir = player._pdir;
if (IsWallSpell(spl)) { if (IsWallSpell(spl)) {
dir = player.tempDirection; dir = player.tempDirection;

2
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. * @param player The player whose readied spell is to be checked.
*/ */
void EnsureValidReadiedSpell(Player &player); 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 * @param pnum player index

Loading…
Cancel
Save