From 794c162c9e92cbcdad73cb82f545876a47afae92 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 12 May 2014 16:04:46 -0700 Subject: Implement proto v2 --- src/mmo/ids.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/mmo/ids.hpp') diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index 3c5b1ba..ed5ab58 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -21,6 +21,7 @@ # include "fwd.hpp" +# include "../ints/little.hpp" # include "../ints/wrap.hpp" # include "extract.hpp" @@ -33,6 +34,8 @@ class CharId : public Wrapped { public: CharId() : Wrapped() class PartyId : public Wrapped { public: PartyId() : Wrapped() {} protected: constexpr explicit PartyId(uint32_t a) : Wrapped(a) {} }; class ItemNameId : public Wrapped { public: ItemNameId() : Wrapped() {} protected: constexpr explicit ItemNameId(uint16_t a) : Wrapped(a) {} }; +class BlockId : public Wrapped { public: BlockId() : Wrapped() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped(a) {} }; + class GmLevel { uint32_t bits; @@ -98,6 +101,30 @@ public: { return l.bits != r.bits; } + + friend + bool native_to_network(Byte *network, GmLevel native) + { + network->value = native.bits; + return true; // LIES. But this code is going away soon anyway + } + friend + bool network_to_native(GmLevel *native, Byte network) + { + native->bits = network.value; + return true; // LIES. But this code is going away soon anyway + } + + friend + bool native_to_network(Little32 *network, GmLevel native) + { + return native_to_network(network, native.bits); + } + friend + bool network_to_native(GmLevel *native, Little32 network) + { + return network_to_native(&native->bits, network); + } }; inline -- cgit v1.2.3-70-g09d2