From 0ddcfb167a3235ecb202db6d641a0b9feae16bfc Mon Sep 17 00:00:00 2001 From: incorpse Date: Thu, 24 Apr 2014 02:30:16 -0500 Subject: [PATCH 1/3] Multidimensional vector typedefs for Tripoint The typedefs will facilitate cleaner code when using multidimensional vectors instead of a 3D Tripoint array. OSX does not play well with the dynamically sized arrays of the Tripoint. --- geometry.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/geometry.h b/geometry.h index e4ff522..1ac1b03 100644 --- a/geometry.h +++ b/geometry.h @@ -145,6 +145,9 @@ struct Tripoint return ret; } }; +typedef std::vector Tripoint1d; +typedef std::vector Tripoint2d; +typedef std::vector Tripoint3d; inline Tripoint operator+(Tripoint lhs, const Tripoint& rhs) { From 62a41be3be9d022e1172b9fb452b8aa4a98a8d1b Mon Sep 17 00:00:00 2001 From: incorpse Date: Thu, 24 Apr 2014 02:32:32 -0500 Subject: [PATCH 2/3] Utilize Tripoint 3D vector instead of 3D array OSX did not like the dynamically sized 3D array of Tripoints. Converted the data structure to use a 3D vector instead. --- pathfind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pathfind.cpp b/pathfind.cpp index 3b353ff..8f26d77 100644 --- a/pathfind.cpp +++ b/pathfind.cpp @@ -500,7 +500,7 @@ Path Pathfinder::path_a_star(Tripoint start, Tripoint end) A_star_status status[x_size][y_size][z_size]; int gscore[x_size][y_size][z_size]; int hscore[x_size][y_size][z_size]; - Tripoint parent[x_size][y_size][z_size]; + Tripoint3d parent(x_size, Tripoint2d(y_size, Tripoint1d(z_size))); if (border > 0) { int x0 = (start.x < end.x ? start.x : end.x); From 4f84d379b8fad9006c20e42aebc158d3b84ea9c7 Mon Sep 17 00:00:00 2001 From: incorpse Date: Thu, 24 Apr 2014 02:34:01 -0500 Subject: [PATCH 3/3] Header guard changed It seems that the _TIME_H_ header guard was being included by another file and would not allow the Time class to compile. Changed the header guard to something unique. Issue found when attempting to compile on OSX. --- time.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.h b/time.h index 2722648..b8838cc 100644 --- a/time.h +++ b/time.h @@ -1,5 +1,5 @@ -#ifndef _TIME_H_ -#define _TIME_H_ +#ifndef _CATTIME_H_ +#define _CATTIME_H_ #include