R-Type 0.1
Loading...
Searching...
No Matches
MessageType.hpp
1#pragma once
2
3#include <cstdint>
4
5#include "protocol/SystemMessages.hpp"
6
7namespace rtype::protocol {
16enum class MessageType : std::uint16_t {
17 Invalid = 0,
18
19 Input = 0x02,
20 Ping = 0x03,
21 Disconnect = 0x04,
22 QueryEntity = 0x13,
23
24 Snapshot = 0x83,
25 CreateEntity = 0x84,
26 DestroyEntity = 0x85,
27 Pong = 0x86
28};
29
35constexpr std::uint16_t toMessageId(MessageType type) {
36 return static_cast<std::uint16_t>(type);
37}
38
40} // namespace rtype::protocol
constexpr std::uint16_t toMessageId(MessageType type)
Converts a message type to its wire identifier.
Definition MessageType.hpp:35
MessageType
Type identifier of every message exchanged on a connection.
Definition MessageType.hpp:16
@ Input
Client to server: actions held by the player.
@ Disconnect
Client to server: closes the connection.
@ Invalid
Never sent, marks an unset type.
@ Pong
Server to client: answer to a Ping.
@ DestroyEntity
Server to client: removes an entity.
@ QueryEntity
Client to server: asks for an unknown entity.
@ Ping
Client to server: latency probe.
@ CreateEntity
Server to client: spawns an entity.
@ Snapshot
Server to client: positions of the entities.