summaryrefslogtreecommitdiff
path: root/src/mmo/ids.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-05-12 16:04:46 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-05-12 17:29:01 -0700
commit794c162c9e92cbcdad73cb82f545876a47afae92 (patch)
tree3b663d40f96fc32d0848d0ae513185bdd4367a92 /src/mmo/ids.hpp
parentc87b1dc338eadc68accac02563a487d7d8e1c9a0 (diff)
downloadtmwa-794c162c9e92cbcdad73cb82f545876a47afae92.tar.gz
tmwa-794c162c9e92cbcdad73cb82f545876a47afae92.tar.bz2
tmwa-794c162c9e92cbcdad73cb82f545876a47afae92.tar.xz
tmwa-794c162c9e92cbcdad73cb82f545876a47afae92.zip
Implement proto v2
Diffstat (limited to 'src/mmo/ids.hpp')
-rw-r--r--src/mmo/ids.hpp27
1 files changed, 27 insertions, 0 deletions
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<uint32_t> { public: CharId() : Wrapped<uint32_t>()
class PartyId : public Wrapped<uint32_t> { public: PartyId() : Wrapped<uint32_t>() {} protected: constexpr explicit PartyId(uint32_t a) : Wrapped<uint32_t>(a) {} };
class ItemNameId : public Wrapped<uint16_t> { public: ItemNameId() : Wrapped<uint16_t>() {} protected: constexpr explicit ItemNameId(uint16_t a) : Wrapped<uint16_t>(a) {} };
+class BlockId : public Wrapped<uint32_t> { public: BlockId() : Wrapped<uint32_t>() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped<uint32_t>(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