aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-12-20 14:03:41 +0000
committerzedarider <ymherklotz@gmail.com>2016-12-20 14:03:41 +0000
commit4b860bee7c48af0fd8ef6e2c749bd03a9899e347 (patch)
treef7bdc32f5d01141bd06041284d5387a212d17502
parent94f92605d1ef644f8aedbd23d70e83e5f0aa4758 (diff)
downloadA-star-algorithm-4b860bee7c48af0fd8ef6e2c749bd03a9899e347.tar.gz
A-star-algorithm-4b860bee7c48af0fd8ef6e2c749bd03a9899e347.zip
removed unnecessary constructor
-rwxr-xr-xbin/mainbin415952 -> 415456 bytes
-rw-r--r--include/astar.hpp5
-rw-r--r--src/astar.cpp15
3 files changed, 2 insertions, 18 deletions
diff --git a/bin/main b/bin/main
index 2b4e483..33ec641 100755
--- a/bin/main
+++ b/bin/main
Binary files 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<Node> 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;