mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 18:13:48 +00:00
fix(Core/Taxi): Fixes crash when player logins and continues flight (#18270)
* fix(Core/Taxi): Fixes crash when player logins and continue flight * Update WaypointMovementGenerator.cpp
This commit is contained in:
committed by
GitHub
parent
a4dc083b42
commit
72e75982be
@@ -347,6 +347,27 @@ void FlightPathMovementGenerator::LoadPath(Player* player)
|
|||||||
|
|
||||||
_pointsForPathSwitch.push_back({ uint32(i_path.size() - 1), int32(ceil(cost * discount)) });
|
_pointsForPathSwitch.push_back({ uint32(i_path.size() - 1), int32(ceil(cost * discount)) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: fixes crash, but can be handled in a better way once we will know how to reproduce it.
|
||||||
|
if (GetCurrentNode() >= i_path.size())
|
||||||
|
{
|
||||||
|
std::string paths;
|
||||||
|
std::deque<uint32> const& taxi = player->m_taxi.GetPath();
|
||||||
|
for (uint32 src = 0, dst = 1; dst < taxi.size(); src = dst++)
|
||||||
|
{
|
||||||
|
uint32 path, cost;
|
||||||
|
sObjectMgr->GetTaxiPath(taxi[src], taxi[dst], path, cost);
|
||||||
|
paths += std::to_string(path) + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR("movement.flightpath", "Failed to build correct path for player: {}. Current node: {}, max nodes: {}. Paths: {}. Player pos: {}.", player->GetGUID().ToString(), GetCurrentNode(), i_path.size(), paths, player->GetPosition().ToString());
|
||||||
|
|
||||||
|
// Lets choose the second last element so that a player would still have some flight.
|
||||||
|
if (int(i_path.size()) - 2 >= 0)
|
||||||
|
i_currentNode = uint32(i_path.size() - 2);
|
||||||
|
else
|
||||||
|
i_currentNode = uint32(i_path.size() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightPathMovementGenerator::DoInitialize(Player* player)
|
void FlightPathMovementGenerator::DoInitialize(Player* player)
|
||||||
|
|||||||
Reference in New Issue
Block a user