From 36d681252b6e886dd594b9c27af4f7712c176392 Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 21 Apr 2024 15:34:38 +0200 Subject: [PATCH] chore(naming): clarified names of PlannerNode maps/sets --- src/planner.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/planner.cpp b/src/planner.cpp index 4a9b4e9..60078d9 100644 --- a/src/planner.cpp +++ b/src/planner.cpp @@ -13,8 +13,8 @@ #include namespace godot::goap { -typedef HashMap FromMap; -typedef HashMap ScoreMap; +typedef HashMap NodeNodeMap; +typedef HashMap NodeScoreMap; typedef HashSet NodeSet; void Goal::_bind_methods() { @@ -69,7 +69,7 @@ void Planner::_enter_tree() { this->actor = Object::cast_to(this->get_parent()); } -static Vector> trace_path(FromMap &map, PlannerNode &end) { +static Vector> trace_path(NodeNodeMap &map, PlannerNode &end) { Vector> edges{}; PlannerNode node{end}; while(node.last_edge.is_valid()) { @@ -91,10 +91,10 @@ Vector> Planner::make_plan() { // ordered list of all nodes still being considered Vector open{PlannerNode::goal_node(goal->goal_state)}; PlannerNode first = open.get(0); - FromMap from{}; // mapping states to the previous in the path - ScoreMap dist_traveled{}; // mapping states to the shortest found distance from start + NodeNodeMap from{}; // mapping states to the previous in the path + NodeScoreMap dist_traveled{}; // mapping states to the shortest found distance from start dist_traveled.insert(first, 0); - ScoreMap best_guess{}; // mapping states to the best guess of the distance to the goal + NodeScoreMap best_guess{}; // mapping states to the best guess of the distance to the goal best_guess.insert(first, first.open_requirements.size()); PlannerNode current{}; // state we're checking for neighbours or completion while(!open.is_empty()) { @@ -123,7 +123,7 @@ Vector> Planner::make_plan() { } } } - UtilityFunctions::push_warning("Failed to find a path satisfying goal"); + UtilityFunctions::push_warning("Failed to find a plan satisfying goal"); this->plan = {}; return this->plan; }