mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
fix: player diagonal walk cost now looks at the value from config (#1792)
Bug Fixes: - Improved diagonal pathfinding accuracy by applying the configured diagonal movement speed when calculating routes. - Ensured path costs consistently reflect player movement settings.
This commit is contained in:
parent
9bfac7719f
commit
5a33b4a166
1 changed files with 2 additions and 2 deletions
|
|
@ -1101,7 +1101,7 @@ PathFindResult_ptr Map::newFindPath(const Position& start, const Position& goal,
|
|||
if (it->second->unseen > 50)
|
||||
continue;
|
||||
|
||||
const float diagonal = ((i == 0 || j == 0) ? 1.0f : 3.0f);
|
||||
float diagonal = ((i == 0 || j == 0) ? 1.0f : g_gameConfig.getPlayerDiagonalWalkSpeed());
|
||||
float cost = it->second->cost * diagonal;
|
||||
cost += diagonal * (50.0f * std::max<float>(5.0f, it->second->pos.distance(goal))); // heuristic
|
||||
if (node->totalCost + cost + 50 < it->second->totalCost) {
|
||||
|
|
@ -1444,7 +1444,7 @@ std::map<std::string, std::tuple<int, int, int, std::string>> Map::findEveryPath
|
|||
continue;
|
||||
}
|
||||
|
||||
float diagonal = ((i == 0 || j == 0) ? 1.0f : 3.0f);
|
||||
float diagonal = ((i == 0 || j == 0) ? 1.0f : g_gameConfig.getPlayerDiagonalWalkSpeed());
|
||||
float cost = it->second->cost * diagonal;
|
||||
if (ignoreCost)
|
||||
cost = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue