diff --git a/src/MultilevelAStarEx.cpp b/src/MultilevelAStarEx.cpp index 60e8bac..f0118c0 100644 --- a/src/MultilevelAStarEx.cpp +++ b/src/MultilevelAStarEx.cpp @@ -14,8 +14,6 @@ using std::vector; static const int STRAIGHT_DISTANCE = 10; static const int DIAGONAL_DISTANCE = 14; -Node::Node() { } - Node::Node(int x, int y) { this->hasUnit = false; @@ -153,14 +151,13 @@ void MultilevelAStarEx::init(const Rect2i ®ion) _height = region.get_size().height; _trans = region.get_position(); - _nodes.resize(_width * _height); + _nodes.reserve(_width * _height); - vector::iterator iter = _nodes.begin(); for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { - *iter++ = Node(x, y); + _nodes.push_back(Node(x, y)); } } diff --git a/src/MultilevelAStarEx.h b/src/MultilevelAStarEx.h index bed0d39..3d12436 100644 --- a/src/MultilevelAStarEx.h +++ b/src/MultilevelAStarEx.h @@ -44,9 +44,6 @@ private: void close(int pass); NodeState state(int pass) const; int total_cost() const; - -public: - Node(); }; class MultilevelAStarEx : public godot::RefCounted