Rule of 5.

This commit is contained in:
2024-07-07 03:13:32 +02:00
parent f5fff89992
commit 89c5961785
2 changed files with 23 additions and 14 deletions

View File

@@ -138,8 +138,6 @@ MultilevelAStarEx::MultilevelAStarEx()
_pass = 0;
}
MultilevelAStarEx::~MultilevelAStarEx() { }
void MultilevelAStarEx::init(const Rect2i &region)
{
DEV_ASSERT(!_init);

View File

@@ -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 &region);
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<godot::Vector2i> 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 &region);
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<godot::Vector2i> find_path(const godot::Vector2i &from, const godot::Vector2i &to, bool return_closest);
};
VARIANT_ENUM_CAST(TerrainType);