diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /core/math/a_star.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'core/math/a_star.h')
| -rw-r--r-- | core/math/a_star.h | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/core/math/a_star.h b/core/math/a_star.h index c4c955ed2..2ac855737 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -35,10 +35,9 @@ @author Juan Linietsky <reduzio@gmail.com> */ -class AStar: public Reference { - - GDCLASS(AStar,Reference) +class AStar : public Reference { + GDCLASS(AStar, Reference) uint64_t pass; @@ -51,16 +50,17 @@ class AStar: public Reference { real_t weight_scale; uint64_t last_pass; - Vector<Point*> neighbours; + Vector<Point *> neighbours; //used for pathfinding Point *prev_point; real_t distance; - Point() : list(this) {} + Point() + : list(this) {} }; - Map<int,Point*> points; + Map<int, Point *> points; struct Segment { union { @@ -74,44 +74,41 @@ class AStar: public Reference { Point *from_point; Point *to_point; - bool operator<(const Segment& p_s) const { return key<p_s.key; } - Segment() { key=0; } - Segment(int p_from,int p_to) { + bool operator<(const Segment &p_s) const { return key < p_s.key; } + Segment() { key = 0; } + Segment(int p_from, int p_to) { if (p_from > p_to) { - SWAP(p_from,p_to); + SWAP(p_from, p_to); } - from=p_from; - to=p_to; + from = p_from; + to = p_to; } }; - Set<Segment> segments; bool _solve(Point *begin_point, Point *end_point); protected: - static void _bind_methods(); -public: +public: int get_available_point_id() const; - void add_point(int p_id,const Vector3& p_pos,real_t p_weight_scale=1); + void add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale = 1); Vector3 get_point_pos(int p_id) const; real_t get_point_weight_scale(int p_id) const; void remove_point(int p_id); - void connect_points(int p_id,int p_with_id); - void disconnect_points(int p_id,int p_with_id); - bool are_points_connected(int p_id,int p_with_id) const; + void connect_points(int p_id, int p_with_id); + void disconnect_points(int p_id, int p_with_id); + bool are_points_connected(int p_id, int p_with_id) const; void clear(); - - int get_closest_point(const Vector3& p_point) const; - Vector3 get_closest_pos_in_segment(const Vector3& p_point) const; + int get_closest_point(const Vector3 &p_point) const; + Vector3 get_closest_pos_in_segment(const Vector3 &p_point) const; PoolVector<Vector3> get_point_path(int p_from_id, int p_to_id); PoolVector<int> get_id_path(int p_from_id, int p_to_id); |
