From 521198c501a4aa75bc92e8bc454098562fec88df Mon Sep 17 00:00:00 2001 From: Ramon Bernardo Date: Thu, 30 Sep 2021 18:15:51 -0300 Subject: [PATCH] Replace hardcoded values for viewport dimensions (#3706) --- src/actions.cpp | 2 +- src/game.cpp | 2 +- src/spells.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/actions.cpp b/src/actions.cpp index 237b21a864..f1d021958a 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -279,7 +279,7 @@ ReturnValue Actions::canUseFar(const Creature* creature, const Position& toPos, return creaturePos.z > toPos.z ? RETURNVALUE_FIRSTGOUPSTAIRS : RETURNVALUE_FIRSTGODOWNSTAIRS; } - if (!Position::areInRange<7, 5>(toPos, creaturePos)) { + if (!Position::areInRange(toPos, creaturePos)) { return RETURNVALUE_TOOFARAWAY; } diff --git a/src/game.cpp b/src/game.cpp index e4d32664e1..2c39029493 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2209,7 +2209,7 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position& fromPos, uin return; } - if (!Position::areInRange<7, 5, 0>(creature->getPosition(), player->getPosition())) { + if (!Position::areInRange(creature->getPosition(), player->getPosition())) { return; } diff --git a/src/spells.cpp b/src/spells.cpp index 98640599f5..3ae3729fe2 100644 --- a/src/spells.cpp +++ b/src/spells.cpp @@ -1013,7 +1013,7 @@ bool InstantSpell::canThrowSpell(const Creature* creature, const Creature* targe const Position& fromPos = creature->getPosition(); const Position& toPos = target->getPosition(); if (fromPos.z != toPos.z || - (range == -1 && !g_game.canThrowObjectTo(fromPos, toPos, checkLineOfSight, true, 7, 5)) || + (range == -1 && !g_game.canThrowObjectTo(fromPos, toPos, checkLineOfSight, true, Map::maxClientViewportX - 1, Map::maxClientViewportY - 1)) || (range != -1 && !g_game.canThrowObjectTo(fromPos, toPos, checkLineOfSight, true, range, range))) { return false; }