Skip to content

Commit

Permalink
-Crash fix: Stop random crashes with tweakvalue enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Jul 11, 2023
1 parent 0c23a5f commit 522f482
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
17 changes: 1 addition & 16 deletions playerbot/strategy/actions/MovementActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
1 change: 0 additions & 1 deletion playerbot/strategy/values/LastMovementValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ namespace ai
WorldPosition lastMoveShort;
TravelPath lastPath;
time_t nextTeleport;
std::future<TravelPath> future;
};

class LastMovementValue : public ManualSetValue<LastMovement&>
Expand Down

0 comments on commit 522f482

Please sign in to comment.