add packet declare syntax check

This commit is contained in:
2024-08-21 12:28:40 +02:00
parent bcc0e0095a
commit a740a503e8
2 changed files with 11 additions and 1 deletions

View File

@@ -14,13 +14,19 @@ namespace protocol {
*/
enum class PacketSenderType {
/** Sent by clients and server */
Both,
Both = 1,
/** Sent by clients to the server */
Client,
/** Sent by server to the clients */
Server,
};
enum class PacketSendType {
Reliable = 1,
Unreliable,
UnreliableOrdered,
};
/**
* \def DeclareAllPacket

View File

@@ -14,5 +14,9 @@ void packets::ConcretePacket<PT, Data>::Accept(PacketVisitor& a_Visitor) const {
a_Visitor.Visit(*this);
}
#define DeclarePacket(PacketName, packetSendType, packetSenderType) static_assert(static_cast<unsigned>(PacketSendType::packetSendType) && static_cast<unsigned>(PacketSenderType::packetSenderType));
DeclareAllPacket()
} // namespace protocol
} // namespace blitz