Skip to content

Commit f140420

Browse files
authored
Merge pull request #2 from Dofes/feat/debug-shape
fix: fix compile
2 parents b26b9f8 + 1970115 commit f140420

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

include/endstone/debugshape/debug_shape.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
namespace endstone {
2828

2929
namespace debugshape_internal {
30-
// Decreases from the maximum value to avoid conflicts with sapi's id allocation
31-
inline std::atomic id_counter{UINT64_MAX};
30+
// Decreases from the maximum value to avoid conflicts with sapi's id allocation
31+
inline std::atomic id_counter{UINT64_MAX};
3232
} // namespace debugshape_internal
3333

3434
/**
@@ -107,20 +107,20 @@ class DebugShape {
107107
* @brief Adds the player to this debug shape causing it to display on the player's screen.
108108
* @param player the player to add.
109109
*/
110-
void addPlayer(const Player &player)
110+
void addPlayer(Player &player)
111111
{
112112
players_.emplace(player.getUniqueId());
113-
player.sendDebugShape(this);
113+
player.sendDebugShape(static_cast<const T &>(*this));
114114
}
115115

116116
/**
117117
* @brief Removes the player from this debug shape causing it to be removed from the player's screen.
118118
* @param player the player to remove.
119119
*/
120-
void removePlayer(const Player &player)
120+
void removePlayer(Player &player)
121121
{
122122
players_.erase(player.getUniqueId());
123-
player.removeDebugShape(this);
123+
player.removeDebugShape(static_cast<const T &>(*this));
124124
}
125125

126126
/**
@@ -157,14 +157,14 @@ class DebugShape {
157157
DebugShapeId id_;
158158
std::optional<Vector<float>> position_;
159159
std::optional<Color> color_;
160-
std::unordered_set<UUID> players_;
160+
mutable std::unordered_set<UUID> players_;
161161

162162
void onChange() const
163163
{
164164
for (const auto &player : getPlayers()) {
165-
player->sendDebugShape(this);
165+
player->sendDebugShape(static_cast<const T &>(*this));
166166
}
167167
}
168168
};
169169

170-
} // namespace endstone
170+
} // namespace endstone

include/endstone/player.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
#include "endstone/form/action_form.h"
2222
#include "endstone/form/message_form.h"
2323
#include "endstone/form/modal_form.h"
24-
#include "endstone/debugshape/debug_arrow.h"
25-
#include "endstone/debugshape/debug_box.h"
26-
#include "endstone/debugshape/debug_circle.h"
27-
#include "endstone/debugshape/debug_line.h"
28-
#include "endstone/debugshape/debug_sphere.h"
29-
#include "endstone/debugshape/debug_text.h"
3024
#include "endstone/game_mode.h"
3125
#include "endstone/inventory/player_inventory.h"
3226
#include "endstone/offline_player.h"
@@ -37,6 +31,13 @@
3731

3832
namespace endstone {
3933

34+
class DebugArrow;
35+
class DebugBox;
36+
class DebugCircle;
37+
class DebugLine;
38+
class DebugSphere;
39+
class DebugText;
40+
4041
/**
4142
* @brief Represents a player.
4243
*/

0 commit comments

Comments
 (0)