summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorhovertank3d <[email protected]>2026-02-23 23:17:56 +0100
committerhovertank3d <[email protected]>2026-02-23 23:38:17 +0100
commit30eb23ffe5f7b9e8c3b4267457d0aa3bd02665e7 (patch)
tree1c09155c7684564f4f642081f6255c76822eda9d /include/net
parentce7c377dd839fd8af71dfe505d930884e6fb0e2e (diff)
downloadogurec-30eb23ffe5f7b9e8c3b4267457d0aa3bd02665e7.tar.gz
ogurec-30eb23ffe5f7b9e8c3b4267457d0aa3bd02665e7.zip
implement `connect`, `disconnect` and `accept`
Diffstat (limited to 'include/net')
-rw-r--r--include/net/types.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/net/types.hpp b/include/net/types.hpp
index b9453d6..5301021 100644
--- a/include/net/types.hpp
+++ b/include/net/types.hpp
@@ -72,6 +72,25 @@ struct vec2 {
T y;
};
+// NetMessages
+
+struct connect {
+ static constexpr uint8_t packet_id = 1;
+
+ std::string version;
+};
+
+struct disconnect {
+ static constexpr uint8_t packet_id = 2;
+
+ nstring reason;
+};
+
+struct accept {
+ uint8_t slot;
+ uint8_t server_flags = 0;
+};
+
inline nstring operator""_ns(const char* str, std::size_t)
{
return nstring{nstring::Literal, str};
@@ -79,3 +98,5 @@ inline nstring operator""_ns(const char* str, std::size_t)
}
}
+
+using net::packet::operator""_ns;