diff --git a/src/MultilevelAStarEx.cpp b/src/MultilevelAStarEx.cpp index f0118c0..65114d1 100644 --- a/src/MultilevelAStarEx.cpp +++ b/src/MultilevelAStarEx.cpp @@ -138,8 +138,6 @@ MultilevelAStarEx::MultilevelAStarEx() _pass = 0; } -MultilevelAStarEx::~MultilevelAStarEx() { } - void MultilevelAStarEx::init(const Rect2i ®ion) { DEV_ASSERT(!_init); diff --git a/src/MultilevelAStarEx.h b/src/MultilevelAStarEx.h index 3d12436..1f1a833 100644 --- a/src/MultilevelAStarEx.h +++ b/src/MultilevelAStarEx.h @@ -24,6 +24,12 @@ public: UNUSED, OPEN, CLOSED }; + Node(const Node &other) = default; + Node(Node &&other) noexcept = default; + ~Node() noexcept = default; + Node& operator=(const Node &other) = default; + Node& operator=(Node &&other) noexcept = default; + private: bool hasUnit; TerrainType terrainType; @@ -50,6 +56,23 @@ class MultilevelAStarEx : public godot::RefCounted { GDCLASS(MultilevelAStarEx, godot::RefCounted) +public: + MultilevelAStarEx(); + + MultilevelAStarEx(const MultilevelAStarEx &other) = delete; + MultilevelAStarEx(MultilevelAStarEx &&other) noexcept = delete; + ~MultilevelAStarEx() noexcept = default; + //MultilevelAStarEx& operator=(const MultilevelAStarEx &other) = delete; // already "removed" by GDCLASS + MultilevelAStarEx& operator=(MultilevelAStarEx &&other) noexcept = delete; + + void init(const godot::Rect2i ®ion); + godot::Rect2i get_region() const; + void set_terrain(const godot::Vector2i &cell, TerrainType type); + TerrainType get_terrain(const godot::Vector2i &cell) const; + void set_unit(const godot::Vector2i &cell, bool blocked); + bool get_unit(const godot::Vector2i &cell) const; + godot::TypedArray find_path(const godot::Vector2i &from, const godot::Vector2i &to, bool return_closest); + private: bool _init; int _pass; @@ -64,18 +87,6 @@ private: protected: static void _bind_methods(); - -public: - MultilevelAStarEx(); - ~MultilevelAStarEx(); - - void init(const godot::Rect2i ®ion); - godot::Rect2i get_region() const; - void set_terrain(const godot::Vector2i &cell, TerrainType type); - TerrainType get_terrain(const godot::Vector2i &cell) const; - void set_unit(const godot::Vector2i &cell, bool blocked); - bool get_unit(const godot::Vector2i &cell) const; - godot::TypedArray find_path(const godot::Vector2i &from, const godot::Vector2i &to, bool return_closest); }; VARIANT_ENUM_CAST(TerrainType);