From 522f482247f20b8931b65662f5afe9eb6690c5e1 Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Tue, 11 Jul 2023 12:42:26 +0200 Subject: [PATCH 1/2] -Crash fix: Stop random crashes with tweakvalue enabled. --- playerbot/strategy/actions/MovementActions.cpp | 17 +---------------- playerbot/strategy/values/LastMovementValue.h | 1 - 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/playerbot/strategy/actions/MovementActions.cpp b/playerbot/strategy/actions/MovementActions.cpp index c0714f838..16d6268cb 100644 --- a/playerbot/strategy/actions/MovementActions.cpp +++ b/playerbot/strategy/actions/MovementActions.cpp @@ -418,22 +418,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, { if (!sTravelNodeMap.getNodes().empty() && !bot->InBattleGround()) { - if (sPlayerbotAIConfig.tweakValue) - { - if (lastMove.future.valid()) - { - if(lastMove.future.wait_for(0s) != future_status::ready) - return true; //we have no path. Wait until it is ready. - movePath = lastMove.future.get(); - } - else - { - lastMove.future = std::async(&TravelNodeMap::getFullPath, startPosition, endPosition, bot); - return true; - } - } - else - movePath = sTravelNodeMap.getFullPath(startPosition, endPosition, bot); + movePath = sTravelNodeMap.getFullPath(startPosition, endPosition, bot); if (movePath.empty()) { diff --git a/playerbot/strategy/values/LastMovementValue.h b/playerbot/strategy/values/LastMovementValue.h index 08256e509..64cdbe397 100644 --- a/playerbot/strategy/values/LastMovementValue.h +++ b/playerbot/strategy/values/LastMovementValue.h @@ -99,7 +99,6 @@ namespace ai WorldPosition lastMoveShort; TravelPath lastPath; time_t nextTeleport; - std::future future; }; class LastMovementValue : public ManualSetValue From 74c1f183dbb0782083b3c959545e1544a8b35163 Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Tue, 11 Jul 2023 12:42:49 +0200 Subject: [PATCH 2/2] -Mount fix: Stops bot mounting/shapeshifting to mount when in water. --- playerbot/strategy/actions/CheckMountStateAction.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/playerbot/strategy/actions/CheckMountStateAction.cpp b/playerbot/strategy/actions/CheckMountStateAction.cpp index 3e1870bfd..30ed9dc73 100644 --- a/playerbot/strategy/actions/CheckMountStateAction.cpp +++ b/playerbot/strategy/actions/CheckMountStateAction.cpp @@ -248,6 +248,9 @@ bool CheckMountStateAction::isUseful() if (!bot->GetPlayerbotAI()->HasStrategy("mount", BotState::BOT_STATE_NON_COMBAT) && !bot->IsMounted()) return false; + if (!bot->IsMounted() && bot->IsInWater()) + return false; + bool firstmount = bot->GetLevel() >= #ifdef MANGOSBOT_ZERO 40