From 1d07cb51104bb5177e04693379d8f6b58d5bd503 Mon Sep 17 00:00:00 2001 From: Jeremiah Morgan Date: Sat, 30 Nov 2024 12:12:12 +0000 Subject: [PATCH 1/2] pathfinding_improvement --- libopenage/pathfinding/pathfinder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libopenage/pathfinding/pathfinder.cpp b/libopenage/pathfinding/pathfinder.cpp index e46919e62b..6a6b81632d 100644 --- a/libopenage/pathfinding/pathfinder.cpp +++ b/libopenage/pathfinding/pathfinder.cpp @@ -231,8 +231,8 @@ const Pathfinder::portal_star_t Pathfinder::portal_a_star(const PathRequest &req auto portal_pos = portal->get_exit_center(start_sector->get_id()); auto portal_abs_pos = sector_pos + portal_pos; auto heuristic_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.target); - - portal_node->current_cost = 0; + std::cout << portal->get_id() << ": " << heuristic_cost << std::endl; + portal_node->current_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.start); portal_node->heuristic_cost = heuristic_cost; portal_node->future_cost = portal_node->current_cost + heuristic_cost; From 7f7d5e222b7db4730cc86e0c74d503d300609e7b Mon Sep 17 00:00:00 2001 From: jere8184 Date: Sat, 30 Nov 2024 12:13:36 +0000 Subject: [PATCH 2/2] Update pathfinder.cpp --- libopenage/pathfinding/pathfinder.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libopenage/pathfinding/pathfinder.cpp b/libopenage/pathfinding/pathfinder.cpp index 6a6b81632d..2fef36053a 100644 --- a/libopenage/pathfinding/pathfinder.cpp +++ b/libopenage/pathfinding/pathfinder.cpp @@ -231,7 +231,6 @@ const Pathfinder::portal_star_t Pathfinder::portal_a_star(const PathRequest &req auto portal_pos = portal->get_exit_center(start_sector->get_id()); auto portal_abs_pos = sector_pos + portal_pos; auto heuristic_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.target); - std::cout << portal->get_id() << ": " << heuristic_cost << std::endl; portal_node->current_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.start); portal_node->heuristic_cost = heuristic_cost; portal_node->future_cost = portal_node->current_cost + heuristic_cost;