Closed STMiki closed 4 months ago
I was thinking of maybe change to a external log library altogether (spdlog for example, which we can add sinks to make the gui code better than currently).
For player.cpp
I don't think we can do much about it, because it makes sense to have all that code here. It is kinda painful to go through but overall I don't see how we can change that :/.
For the Player.cpp
I think there are parts that can be optimized (the registry cough cough). But most of the code are event handling, so we can reduce it a little, but not by much unfortunately
The registry is already planned to be reworked, but for the event handling I think that it is fine. Putting that stuff in other folders might just make the code less maintainable overall (Just a supposition).
Sound System is ticked in the worldGroup running cycle https://github.com/CubicMC/cubic-server/blob/ad0f0ab975fc308786653893c6d2cbc3f7dbc67f/cubic-server/WorldGroup.cpp#L35
Make all enum's streamable to be able to use them in the logger without having to cast everywhere.
change where some define are to put them all in a specific file (like UNUSED who is in Server.hpp)
#define _SEND_PACKET_DECLARATION(packet, debug) \
void Player::send##packet(const protocol::packet &data) \
{ \
auto pck = protocol::create##packet(data); \
_cli->_sendData(*pck); \
LDEBUG(debug); \
}
#define SEND_PACKET_DECLARATION_WITH_DEBUG(packet, debug) _SEND_PACKET_DECLARATION(packet, debug)
#define SEND_PACKET_DECLARATION(packet) _SEND_PACKET_DECLARATION(packet, "Sent a" #packet " packet")
Idea for reducing the size of player.cpp
Global
from identifier intypes.hpp
playerPickupItem()
)