From 4b860bee7c48af0fd8ef6e2c749bd03a9899e347 Mon Sep 17 00:00:00 2001 From: zedarider Date: Tue, 20 Dec 2016 14:03:41 +0000 Subject: removed unnecessary constructor --- bin/main | Bin 415952 -> 415456 bytes include/astar.hpp | 5 ++--- src/astar.cpp | 15 --------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/bin/main b/bin/main index 2b4e483..33ec641 100755 Binary files a/bin/main and b/bin/main differ diff --git a/include/astar.hpp b/include/astar.hpp index d4384e3..4f1ab96 100644 --- a/include/astar.hpp +++ b/include/astar.hpp @@ -15,7 +15,6 @@ class AStar { public: AStar(); - AStar(int *curr_graph, const unsigned int& width, const unsigned int& height); bool start_algorithm(int *curr_graph, const unsigned int& width, const unsigned int& height); @@ -25,8 +24,8 @@ private: std::vector closed_set; int *graph; - int graph_width; - int graph_height; + unsigned int graph_width; + unsigned int graph_height; int path_length; Node start_node, end_node; diff --git a/src/astar.cpp b/src/astar.cpp index 120f4e4..43851a1 100644 --- a/src/astar.cpp +++ b/src/astar.cpp @@ -5,21 +5,6 @@ AStar::AStar() : graph(NULL), graph_width(0), graph_height(0), path_length(10) { } -AStar::AStar(int *curr_graph, const unsigned int& width, const unsigned int& height) : graph(curr_graph), graph_width(width), graph_height(height), path_length(10) { - for(unsigned int i = 0; i < graph_width * graph_height; ++i) - if(graph[i] == 3) { - start_node.x = i % graph_width; - start_node.y = i / graph_width; - start_node.g_score = 0; - calc_heuristic(start_node); - start_node.f_score = start_node.g_score + start_node.f_score; - } else if(graph[i] == 2) { - end_node.x = i % graph_width; - end_node.y = i / graph_width; - } - open_set.push(start_node); -} - bool AStar::start_algorithm(int *curr_graph, const unsigned int& width, const unsigned int& height) { graph_width = width; graph_height = height; -- cgit