diff --git a/modules/client_options/data_options.lua b/modules/client_options/data_options.lua index 0e360f75c..af5e618e8 100644 --- a/modules/client_options/data_options.lua +++ b/modules/client_options/data_options.lua @@ -150,27 +150,28 @@ return { g_app.setDrawTexts(value) end }, - walkFirstStepDelay = { + walkTurnDelay = { value = 250, action = function(value, options, controller, panels, extraWidgets) - panels.generalPanel:recursiveGetChildById('walkFirstStepDelay'):setText(string.format( - 'Walk Delay after first step: %sms', value)) - g_game.setWalkFirstStepDelay(value) + panels.generalPanel:recursiveGetChildById('walkTurnDelay'):setText(string.format( + 'Walk delay after turn: %sms', + value)) end }, - walkTurnDelay = { - value = 100, + walkTeleportDelay = { + value = 250, action = function(value, options, controller, panels, extraWidgets) - panels.generalPanel:recursiveGetChildById('walkTurnDelay'):setText(string.format( - 'Walk delay after turn: %sms', + panels.generalPanel:recursiveGetChildById('walkTeleportDelay'):setText(string.format( + 'Walk delay after teleport: %sms', value)) - g_game.setWalkTurnDelay(value) end }, - turnDelay = { - value = 50, + walkStairsDelay = { + value = 250, action = function(value, options, controller, panels, extraWidgets) - panels.generalPanel:recursiveGetChildById('turnDelay'):setText(string.format('Turn delay: %sms', value)) + panels.generalPanel:recursiveGetChildById('walkStairsDelay'):setText(string.format( + 'Walk delay after floor change: %sms', + value)) end }, hotkeyDelay = { @@ -418,7 +419,7 @@ return { end end }, - showExpiryInInvetory = { + showExpiryInInvetory = { value = true, event = nil, action = function(value, options, controller, panels, extraWidgets) @@ -431,7 +432,7 @@ return { end, 100) end }, - showExpiryInContainers = { + showExpiryInContainers = { value = true, event = nil, action = function(value, options, controller, panels, extraWidgets) @@ -463,10 +464,10 @@ return { end, 100) end }, - autoSwitchPreset = false, - listKeybindsPanel = { + autoSwitchPreset = false, + listKeybindsPanel = { action = function(value, options, controller, panels, extraWidgets) listKeybindsComboBox(value) end }, -} \ No newline at end of file +} diff --git a/modules/client_options/styles/controls/general.otui b/modules/client_options/styles/controls/general.otui index c954414b3..aef3ab4ba 100644 --- a/modules/client_options/styles/controls/general.otui +++ b/modules/client_options/styles/controls/general.otui @@ -114,15 +114,15 @@ UIWidget height: 22 OptionScaleScroll - id: walkFirstStepDelay - !text: tr('Walk Delay after first step: 50ms') + id: walkTurnDelay + !text: tr('Walk delay after turn: 50ms') anchors.fill: parent - &minimumScrollValue: 50 + &minimumScrollValue: 10 &maximumScrollValue: 500 &scrollSize: 21 @onSetup: | - local value = modules.client_options.getOption('walkFirstStepDelay') - self:setText(tr('Walk Delay after first step: %dms', value)) + local value = modules.client_options.getOption('walkTurnDelay') + self:setText(tr('Walk delay after turn: %dms', value)) SmallReversedQtPanel anchors.left: parent.left @@ -132,14 +132,14 @@ UIWidget height: 22 OptionScaleScroll - id: walkTurnDelay - !text: tr('Walk delay after turn: 50ms') + id: walkTeleportDelay + !text: tr('Walk delay after teleport: 200ms') anchors.fill: parent &minimumScrollValue: 50 &maximumScrollValue: 500 &scrollSize: 21 @onSetup: | - local value = modules.client_options.getOption('walkTurnDelay') + local value = modules.client_options.getOption('walkTeleportDelay') self:setText(tr('Walk delay after turn: %dms', value)) SmallReversedQtPanel @@ -150,15 +150,15 @@ UIWidget height: 22 OptionScaleScroll - id: turnDelay - !text: tr('Turn delay: 30ms') + id: walkStairsDelay + !text: tr('Walk delay after floor change: 200ms') anchors.fill: parent - &minimumScrollValue: 30 - &maximumScrollValue: 250 + &minimumScrollValue: 50 + &maximumScrollValue: 500 &scrollSize: 21 @onSetup: | - local value = modules.client_options.getOption('turnDelay') - self:setText(tr('Turn delay: %dms', value)) + local value = modules.client_options.getOption('walkStairsDelay') + self:setText(tr('Walk delay after turn: %dms', value)) QtButton id: hotkeysButton diff --git a/modules/game_walk/walk.lua b/modules/game_walk/walk.lua index ef1a0877a..2e5e06e92 100644 --- a/modules/game_walk/walk.lua +++ b/modules/game_walk/walk.lua @@ -1,15 +1,17 @@ -local WALK_STEPS_RETRY = 10 - -local firstStep = false local smartWalkDirs = {} local smartWalkDir = nil -local lastDirTime = g_clock.millis() -local lastManualWalk = 0 +local walkEvent = nil +local lastTurn = 0 function init() connect(g_game, { onGameStart = onGameStart, - }, true) + onTeleport = onTeleport, + }) + connect(LocalPlayer, { + onWalk = onWalk, + onCancelWalk = onCancelWalk + }) bindKeys() end @@ -17,6 +19,10 @@ end function terminate() disconnect(g_game, { onGameStart = onGameStart, + onTeleport = onTeleport, + }) + disconnect(LocalPlayer, { + onWalk = onWalk, }) stopSmartWalk() @@ -25,8 +31,8 @@ end function onGameStart() modules.game_interface.getRootPanel().onFocusChange = stopSmartWalk - modules.game_joystick.addOnJoystickMoveListener(function(dir, firstStep) - g_game.walk(dir, firstStep) + modules.game_joystick.addOnJoystickMoveListener(function(dir) + g_game.walk(dir) end) -- open tibia has delay in auto walking @@ -64,42 +70,46 @@ function bindKeys() end function bindWalkKey(key, dir) + local gameRootPanel = modules.game_interface.getRootPanel() g_keyboard.bindKeyDown(key, function() - onWalkKeyDown(dir) - end, modules.game_interface.getRootPanel(), true) + changeWalkDir(dir) + end, gameRootPanel, true) g_keyboard.bindKeyUp(key, function() changeWalkDir(dir, true) - end, modules.game_interface.getRootPanel(), true) - g_keyboard.bindKeyPress(key, function() - smartWalk(dir) - end, modules.game_interface.getRootPanel()) + end, gameRootPanel, true) + g_keyboard.bindKeyPress(key, function(_, _, ticks) smartWalk(dir, ticks) end, gameRootPanel) - g_keyboard.setKeyDelay(key, 10) + g_keyboard.setKeyDelay(key, 20) end function unbindWalkKey(key) - g_keyboard.unbindKeyDown(key, modules.game_interface.getRootPanel()) - g_keyboard.unbindKeyUp(key, modules.game_interface.getRootPanel()) - g_keyboard.unbindKeyPress(key, modules.game_interface.getRootPanel()) + local gameRootPanel = modules.game_interface.getRootPanel() + g_keyboard.unbindKeyDown(key, gameRootPanel) + g_keyboard.unbindKeyUp(key, gameRootPanel) + g_keyboard.unbindKeyPress(key, gameRootPanel) - g_keyboard.setKeyDelay(key, 30) + g_keyboard.setKeyDelay(key, 20) end function bindTurnKey(key, dir) - local function callback(widget, code, repeatTicks) - if g_clock.millis() - lastDirTime >= modules.client_options.getOption('turnDelay') then - g_game.turn(dir) - changeWalkDir(dir) - - lastDirTime = g_clock.millis() - end + if modules.game_interface then + local gameRootPanel = modules.game_interface.getRootPanel() + g_keyboard.bindKeyDown(key, function() turn(dir, false) end, gameRootPanel) + g_keyboard.bindKeyPress(key, function() turn(dir, true) end, gameRootPanel) + g_keyboard.bindKeyUp(key, function() + local player = g_game.getLocalPlayer() + if player then player:lockWalk(200) end + end, gameRootPanel) end - - g_keyboard.bindKeyPress(key, callback, modules.game_interface.getRootPanel()) end function unbindTurnKey(key) - g_keyboard.unbindKeyPress(key, modules.game_interface.getRootPanel()) + if modules.game_interface then + local gameRootPanel = modules.game_interface.getRootPanel() + g_keyboard.unbindKeyDown(key, gameRootPanel) + g_keyboard.unbindKeyPress(key, gameRootPanel) + g_keyboard.unbindKeyUp(key, gameRootPanel) + end end function stopSmartWalk() @@ -107,19 +117,8 @@ function stopSmartWalk() smartWalkDir = nil end -function onWalkKeyDown(dir) - if modules.client_options.getOption('autoChaseOverride') then - if g_game.isAttacking() and g_game.getChaseMode() == ChaseOpponent then - g_game.setChaseMode(DontChase) - end - end - firstStep = true - changeWalkDir(dir) -end - function changeWalkDir(dir, pop) - while table.removevalue(smartWalkDirs, dir) do - end + while table.removevalue(smartWalkDirs, dir) do end if pop then if #smartWalkDirs == 0 then stopSmartWalk() @@ -149,12 +148,121 @@ function changeWalkDir(dir, pop) end end -function smartWalk(dir) - if g_keyboard.getModifiers() ~= KeyboardNoModifier then - return false +function smartWalk(dir, ticks) + if walkEvent then + walkEvent:cancel() end - g_game.walk(smartWalkDir or dir) + walkEvent = scheduleEvent(function() + if g_keyboard.getModifiers() ~= KeyboardNoModifier then + return + end + local direction = smartWalkDir or dir + walk(direction, ticks) + end, 10) +end + +function walk(dir, ticks) + local player = g_game.getLocalPlayer() + if not player or g_game.isDead() or player:isDead() then + return + end + + if player:isWalkLocked() then + cancelWalkEvent() + return + end + + if not player:canWalk(dir) then + local ticksLeft = player:getStepTicksLeft() + if ticksLeft < 100 then + cancelWalkEvent() + walkEvent = scheduleEvent(function() walk(dir, ticks) end, ticksLeft) + end + return + end + + if g_game.isFollowing() then + g_game.cancelFollow() + end + + if player:isAutoWalking() then + player:stopAutoWalk() + g_game.stop() + end + + local toPos = Position.translatedToDirection(player:getPosition(), dir) + local toTile = g_map.getTile(toPos) + if toTile and toTile:isWalkable() then + if not player:isPreWalking() then + player:preWalk(dir) + end + else + -- check for stairs/elevation steps + if not canChangeFloorDown(toPos) and not canChangeFloorUp(toPos) then + return false + end + + player:lockWalk(200) + end + + g_game.walk(dir) return true -end \ No newline at end of file +end + +function turn(dir, repeated) + local player = g_game.getLocalPlayer() + if player:isWalking() and player:getDirection() == dir then + return + end + + cancelWalkEvent() + + local delay = repeated and 1000 or 200 + + if lastTurn + delay < g_clock.millis() then + g_game.turn(dir) + changeWalkDir(dir) + lastTurn = g_clock.millis() + player:lockWalk(g_settings.getNumber("walkTurnDelay")) + end +end + +function canChangeFloorDown(pos) + pos.z = pos.z + 1 + local toTile = g_map.getTile(pos) + return toTile and toTile:hasElevation(3) +end + +function canChangeFloorUp(pos) + pos.z = pos.z - 1 + local toTile = g_map.getTile(pos) + return toTile and toTile:isWalkable() +end + +function cancelWalkEvent() + if walkEvent then + walkEvent:cancel() + walkEvent = nil + end +end + +-- events +function onTeleport(player, newPos, oldPos) + if not newPos or not oldPos then + return + end + + if Position.offsetX(newPos, oldPos) >= 3 or Position.offsetY(newPos, oldPos) >= 3 or Position.offsetZ(newPos, oldPos) >= 2 then + -- teleport + player:lockWalk(g_settings.getNumber("walkTeleportDelay")) + else + -- floor change is also teleport + player:lockWalk(g_settings.getNumber("walkStairsDelay")) + end +end + +function onCancelWalk(player) + player:lockWalk(50) +end diff --git a/modules/gamelib/position.lua b/modules/gamelib/position.lua index 60defdd3c..2bb64e85f 100644 --- a/modules/gamelib/position.lua +++ b/modules/gamelib/position.lua @@ -32,6 +32,18 @@ function Position.distance(pos1, pos2) return math.sqrt(math.pow((pos2.x - pos1.x), 2) + math.pow((pos2.y - pos1.y), 2)) end +function Position.offsetX(pos1, pos2) + return math.abs(pos2.x - pos1.x) +end + +function Position.offsetY(pos1, pos2) + return math.abs(pos2.y - pos1.y) +end + +function Position.offsetZ(pos1, pos2) + return math.abs(pos2.z - pos1.z) +end + function Position.manhattanDistance(pos1, pos2) return math.abs(pos2.x - pos1.x) + math.abs(pos2.y - pos1.y) end diff --git a/src/client/creature.cpp b/src/client/creature.cpp index 1d7d49f36..0e9f03e0f 100644 --- a/src/client/creature.cpp +++ b/src/client/creature.cpp @@ -557,6 +557,12 @@ void Creature::updateWalkAnimation() if (footAnimPhases == 0) return; + // diagonal walk is taking longer than the animation, thus why don't animate continously + if (m_walkTimer.ticksElapsed() < getStepDuration() && m_walkedPixels == g_gameConfig.getSpriteSize()) { + m_walkAnimationPhase = 0; + return; + } + int minFootDelay = 20; const int maxFootDelay = footAnimPhases > 2 ? 80 : 205; int footAnimDelay = footAnimPhases; diff --git a/src/client/game.cpp b/src/client/game.cpp index f48776f17..d91a88e5f 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -635,80 +635,6 @@ bool Game::walk(const Otc::Direction direction) if (!canPerformGameAction() || direction == Otc::InvalidDirection) return false; - // must cancel auto walking, and wait next try - if (m_localPlayer->isAutoWalking()) { - m_protocolGame->sendStop(); - m_localPlayer->stopAutoWalk(); - return false; - } - - static ScheduledEventPtr nextWalkSchedule = nullptr; - static uint16_t steps = 0; - static Timer timer; - - if (nextWalkSchedule) nextWalkSchedule->cancel(); - nextWalkSchedule = g_dispatcher.scheduleEvent([this] { - nextWalkSchedule = nullptr; - steps = 0; - }, 150); - - // check we can walk and add new walk event if false - if (!m_localPlayer->canWalk(direction)) { - return false; - } - - if (steps == 1) { - if (timer.ticksElapsed() <= m_walkFirstStepDelay) - return false; - } else if (direction != m_localPlayer->getDirection()) { - if (timer.ticksElapsed() <= m_walkTurnDelay) - return false; - } - - ++steps; - timer.restart(); - - const auto& toPos = m_localPlayer->getPosition().translatedToDirection(direction); - - // only do prewalks to walkable tiles (like grounds and not walls) - const auto& toTile = g_map.getTile(toPos); - if (toTile && toTile->isWalkable()) { - m_localPlayer->preWalk(direction); - } else { - // check if can walk to a lower floor - const auto& canChangeFloorDown = [&]() -> bool { - Position pos = toPos; - if (!pos.down()) - return false; - - const auto& toTile = g_map.getTile(pos); - return toTile && toTile->hasElevation(3); - }; - - // check if can walk to a higher floor - const auto& canChangeFloorUp = [&]() -> bool { - const auto& fromTile = m_localPlayer->getTile(); - if (!fromTile || !fromTile->hasElevation(3)) - return false; - - Position pos = toPos; - if (!pos.up()) - return false; - - const auto& toTile = g_map.getTile(pos); - return toTile && toTile->isWalkable(); - }; - - if (!(canChangeFloorDown() || canChangeFloorUp() || !toTile || toTile->isEmpty())) - return false; - - m_localPlayer->lockWalk(); - } - - // must cancel follow before any new walk - if (isFollowing()) - cancelFollow(); - g_lua.callGlobalField("g_game", "onWalk", direction); forceWalk(direction); diff --git a/src/client/game.h b/src/client/game.h index 9df762b91..e7a8f516a 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -696,12 +696,6 @@ class Game void setCustomOs(const Otc::OperatingSystem_t os) { m_clientCustomOs = os; } Otc::OperatingSystem_t getOs(); - void setWalkTurnDelay(const uint16_t v) { m_walkTurnDelay = v; } - void setWalkFirstStepDelay(const uint16_t v) { m_walkFirstStepDelay = v; } - - uint16_t getWalkTurnDelay() { return m_walkTurnDelay; } - uint16_t getWalkFirstStepDelay() { return m_walkFirstStepDelay; } - bool canPerformGameAction() const; bool checkBotProtection() const; bool isEnabledBotProtection() { @@ -821,8 +815,6 @@ class Game bool m_canReportBugs{ false }; uint8_t m_openPvpSituations{ 0 }; - uint16_t m_walkFirstStepDelay{ 200 }; - uint16_t m_walkTurnDelay{ 100 }; uint16_t m_serverBeat{ 50 }; uint16_t m_pingDelay{ 1000 }; uint16_t m_protocolVersion{ 0 }; diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp index 5b6e1962c..c09b532a5 100644 --- a/src/client/localplayer.cpp +++ b/src/client/localplayer.cpp @@ -48,7 +48,7 @@ void LocalPlayer::walk(const Position& oldPos, const Position& newPos) { m_autoWalkRetries = 0; - if (m_preWalking) { + if (isPreWalking()) { m_preWalking = false; if (newPos == m_lastPrewalkDestination) { updateWalk(); @@ -208,6 +208,7 @@ void LocalPlayer::terminateWalk() { Creature::terminateWalk(); m_preWalking = false; + callLuaField("onWalkFinish"); } void LocalPlayer::onPositionChange(const Position& newPos, const Position& oldPos) diff --git a/src/client/localplayer.h b/src/client/localplayer.h index d048e572d..abd774886 100644 --- a/src/client/localplayer.h +++ b/src/client/localplayer.h @@ -116,6 +116,9 @@ class LocalPlayer final : public Player void onPositionChange(const Position& newPos, const Position& oldPos) override; + void preWalk(Otc::Direction direction); + Position getLastPrewalkingPosition() { return m_lastPrewalkDestination; } + protected: void walk(const Position& oldPos, const Position& newPos) override; void updateWalk(const bool /*isPreWalking*/ = false) override { Creature::updateWalk(m_preWalking); } @@ -133,7 +136,6 @@ class LocalPlayer final : public Player uint16_t baseLevel{ 0 }; uint16_t levelPercent{ 0 }; }; - void preWalk(Otc::Direction direction); void cancelWalk(Otc::Direction direction = Otc::InvalidDirection); bool retryAutoWalk(); diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index bdb716b89..69e8d184f 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -381,11 +381,6 @@ void Client::registerLuaFunctions() g_lua.bindSingletonFunction("g_game", "sendStatusTrackerBestiary", &Game::sendStatusTrackerBestiary, &g_game); g_lua.bindSingletonFunction("g_game", "sendCyclopediaHouseAuction", &Game::requestSendCyclopediaHouseAuction, &g_game); - g_lua.bindSingletonFunction("g_game", "getWalkTurnDelay", &Game::getWalkTurnDelay, &g_game); - g_lua.bindSingletonFunction("g_game", "getWalkFirstStepDelay", &Game::getWalkFirstStepDelay, &g_game); - g_lua.bindSingletonFunction("g_game", "setWalkTurnDelay", &Game::setWalkTurnDelay, &g_game); - g_lua.bindSingletonFunction("g_game", "setWalkFirstStepDelay", &Game::setWalkFirstStepDelay, &g_game); - g_lua.registerSingletonClass("g_gameConfig"); g_lua.bindSingletonFunction("g_gameConfig", "loadFonts", &GameConfig::loadFonts, &g_gameConfig); g_lua.bindSingletonFunction("g_gameConfig", "getSpriteSize", &GameConfig::getSpriteSize, &g_gameConfig); @@ -818,6 +813,7 @@ void Client::registerLuaFunctions() g_lua.registerClass(); g_lua.bindClassMemberFunction("unlockWalk", &LocalPlayer::unlockWalk); g_lua.bindClassMemberFunction("lockWalk", &LocalPlayer::lockWalk); + g_lua.bindClassMemberFunction("isWalkLocked", &LocalPlayer::isWalkLocked); g_lua.bindClassMemberFunction("canWalk", &LocalPlayer::canWalk); g_lua.bindClassMemberFunction("setStates", &LocalPlayer::setStates); g_lua.bindClassMemberFunction("setSkill", &LocalPlayer::setSkill); @@ -858,6 +854,8 @@ void Client::registerLuaFunctions() g_lua.bindClassMemberFunction("isPremium", &LocalPlayer::isPremium); g_lua.bindClassMemberFunction("isKnown", &LocalPlayer::isKnown); g_lua.bindClassMemberFunction("isPreWalking", &LocalPlayer::isPreWalking); + g_lua.bindClassMemberFunction("preWalk", &LocalPlayer::preWalk); + g_lua.bindClassMemberFunction("getLastPrewalkingPosition", &LocalPlayer::getLastPrewalkingPosition); g_lua.bindClassMemberFunction("hasSight", &LocalPlayer::hasSight); g_lua.bindClassMemberFunction("isAutoWalking", &LocalPlayer::isAutoWalking); g_lua.bindClassMemberFunction("stopAutoWalk", &LocalPlayer::stopAutoWalk); @@ -885,6 +883,7 @@ void Client::registerLuaFunctions() g_lua.bindClassMemberFunction("getCreatures", &Tile::getCreatures); g_lua.bindClassMemberFunction("getGround", &Tile::getGround); g_lua.bindClassMemberFunction("isWalkable", &Tile::isWalkable); + g_lua.bindClassMemberFunction("hasElevation", &Tile::hasElevation); g_lua.bindClassMemberFunction("isFullGround", &Tile::isFullGround); g_lua.bindClassMemberFunction("isFullyOpaque", &Tile::isFullyOpaque); diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 4604e0fe3..676466ec5 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -1233,6 +1233,7 @@ void ProtocolGame::parseFloorDescription(const InputMessagePtr& msg) void ProtocolGame::parseMapDescription(const InputMessagePtr& msg) { const auto& pos = getPosition(msg); + const auto& oldPos = m_localPlayer->getPosition(); if (!m_mapKnown) { m_localPlayer->setPosition(pos); @@ -1249,6 +1250,7 @@ void ProtocolGame::parseMapDescription(const InputMessagePtr& msg) } g_dispatcher.addEvent([] { g_lua.callGlobalField("g_game", "onMapDescription"); }); + g_lua.callGlobalField("g_game", "onTeleport", m_localPlayer, pos, oldPos); } void ProtocolGame::parseMapMoveNorth(const InputMessagePtr& msg) @@ -2523,9 +2525,12 @@ void ProtocolGame::parseFloorChangeUp(const InputMessagePtr& msg) setFloorDescription(msg, pos.x - range.left, pos.y - range.top, pos.z - g_gameConfig.getMapAwareUndergroundFloorRange(), range.horizontal(), range.vertical(), 3, skip); } - ++pos.x; - ++pos.y; - g_map.setCentralPosition(pos); + auto newPos = pos; + ++newPos.x; + ++newPos.y; + g_map.setCentralPosition(newPos); + + g_lua.callGlobalField("g_game", "onTeleport", m_localPlayer, newPos, pos); } void ProtocolGame::parseFloorChangeDown(const InputMessagePtr& msg) @@ -2546,9 +2551,12 @@ void ProtocolGame::parseFloorChangeDown(const InputMessagePtr& msg) setFloorDescription(msg, pos.x - range.left, pos.y - range.top, pos.z + g_gameConfig.getMapAwareUndergroundFloorRange(), range.horizontal(), range.vertical(), -3, skip); } - --pos.x; - --pos.y; - g_map.setCentralPosition(pos); + auto newPos = pos; + --newPos.x; + --newPos.y; + g_map.setCentralPosition(newPos); + + g_lua.callGlobalField("g_game", "onTeleport", m_localPlayer, newPos, pos); } void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg) const diff --git a/src/client/tile.h b/src/client/tile.h index eacc54b64..8c25b106f 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -181,7 +181,7 @@ class Tile final : public AttachableObject ; } - bool hasElevation(const int elevation = 1) const { return m_elevation >= elevation; } + bool hasElevation(const int elevation = 1) { return m_elevation >= elevation; } #ifdef FRAMEWORK_EDITOR void overwriteMinimapColor(uint8_t color) { m_minimapColor = color; } @@ -229,7 +229,7 @@ class Tile final : public AttachableObject setThingFlag(thing); } - bool hasThingWithElevation() const { return hasElevation() && m_thingTypeFlag & HAS_THING_WITH_ELEVATION; } + bool hasThingWithElevation() { return hasElevation() && m_thingTypeFlag & HAS_THING_WITH_ELEVATION; } void markHighlightedThing(const Color& color) { if (m_highlightThingStackPos > -1 && m_highlightThingStackPos < static_cast(m_things.size())) { m_things[m_highlightThingStackPos]->setMarked(color);