Skip to content

Commit

Permalink
refactor: 移除NodeTree::Node默认构造函数
Browse files Browse the repository at this point in the history
  • Loading branch information
engsr6982 committed Oct 28, 2024
1 parent 75957d2 commit 4032518
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/plotcraft/command/Command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static const auto LambdaFindUnownedPlot = [](CommandOrigin const& origin, Comman
}

player.teleport(result->getSafestPos(), getPlotWorldDimensionId());
sendText<LogLevel::Success>(player, "已传送到无主地皮!");
};


Expand Down
2 changes: 1 addition & 1 deletion src/plotcraft/data/PlotDBStorage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ std::optional<PlotPos> PlotDBStorage::findUnownedPlot() const {
NodeTree tree;

for (auto const& [_, ptr] : mPlotList) {
tree.insert(NodeTree::Node(ptr->getX(), ptr->getZ()));
tree.insert(ptr->getX(), ptr->getZ());
}

auto result = tree.findNearestUnmarkedNodeFromRoot();
Expand Down
2 changes: 1 addition & 1 deletion src/plotcraft/private/NodeTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NodeTree {
int x, z; // 坐标
double distance{0.0}; // 距离

Node() = default;
Node() = delete;
Node(int x, int z) : x(x), z(z) {}
Node(NodePair const& p) : x(p.first), z(p.second) {}
Node(int x, int z, double distance) : x(x), z(z), distance(distance) {}
Expand Down
2 changes: 1 addition & 1 deletion test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NodeTree {
int x, z; // 坐标
double distance{0.0}; // 距离

Node() = default;
Node() = delete;
Node(int x, int z) : x(x), z(z) {}
Node(NodePair const& p) : x(p.first), z(p.second) {}
Node(int x, int z, double distance) : x(x), z(z), distance(distance) {}
Expand Down

0 comments on commit 4032518

Please sign in to comment.