summaryrefslogtreecommitdiff
path: root/core/math/a_star.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-14 12:53:38 +0200
committerGitHub <noreply@github.com>2020-05-14 12:53:38 +0200
commit5f5f53e8eba5c9b708714de58d3cca6ceb010279 (patch)
tree8bebdce946466ce8e9476ccd46c9dba62c323938 /core/math/a_star.h
parente7c9d818766a119089873e4941e4865fb36883ec (diff)
parent1f6f364a56319eabd02c050746fe7df3f55ffee3 (diff)
Merge pull request #38697 from akien-mga/member-init-c++11
Port member default initialization from constructor to declaration (C++11)
Diffstat (limited to 'core/math/a_star.h')
-rw-r--r--core/math/a_star.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 8c10ace33c..ffb437ee04 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -47,17 +47,15 @@ class AStar : public Reference {
struct Point {
- Point() :
- neighbours(4u),
- unlinked_neighbours(4u) {}
+ Point() {}
int id;
Vector3 pos;
real_t weight_scale;
bool enabled;
- OAHashMap<int, Point *> neighbours;
- OAHashMap<int, Point *> unlinked_neighbours;
+ OAHashMap<int, Point *> neighbours = 4u;
+ OAHashMap<int, Point *> unlinked_neighbours = 4u;
// Used for pathfinding.
Point *prev_point;
@@ -85,7 +83,7 @@ class AStar : public Reference {
int32_t u;
int32_t v;
};
- uint64_t key;
+ uint64_t key = 0;
};
enum {
@@ -94,13 +92,11 @@ class AStar : public Reference {
BACKWARD = 2,
BIDIRECTIONAL = FORWARD | BACKWARD
};
- unsigned char direction;
+ unsigned char direction = NONE;
bool operator<(const Segment &p_s) const { return key < p_s.key; }
- Segment() {
- key = 0;
- direction = NONE;
- }
+
+ Segment() {}
Segment(int p_from, int p_to) {
if (p_from < p_to) {
u = p_from;
@@ -114,8 +110,8 @@ class AStar : public Reference {
}
};
- int last_free_id;
- uint64_t pass;
+ int last_free_id = 0;
+ uint64_t pass = 1;
OAHashMap<int, Point *> points;
Set<Segment> segments;
@@ -159,7 +155,7 @@ public:
Vector<Vector3> get_point_path(int p_from_id, int p_to_id);
Vector<int> get_id_path(int p_from_id, int p_to_id);
- AStar();
+ AStar() {}
~AStar();
};
@@ -206,8 +202,8 @@ public:
Vector<Vector2> get_point_path(int p_from_id, int p_to_id);
Vector<int> get_id_path(int p_from_id, int p_to_id);
- AStar2D();
- ~AStar2D();
+ AStar2D() {}
+ ~AStar2D() {}
};
#endif // A_STAR_H