From f6324ada91d412e041592598245770835991cbc6 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 20 May 2014 14:36:33 -0700 Subject: Generate login/user protocol --- src/proto2/types.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/proto2/types.hpp') diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp index b047865..92413e3 100644 --- a/src/proto2/types.hpp +++ b/src/proto2/types.hpp @@ -32,6 +32,7 @@ # include "../mmo/strs.hpp" # include "../mmo/utils.hpp" # include "../mmo/version.hpp" +# include "../login/types.hpp" template bool native_to_network(T *network, T native) { @@ -297,4 +298,22 @@ bool network_to_native(Version *native, NetVersion network) return rv; } +inline __attribute__((warn_unused_result)) +bool native_to_network(Byte *network, VERSION_2 native) +{ + bool rv = true; + uint8_t tmp = static_cast(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(VERSION_2 *native, Byte network) +{ + bool rv = true; + uint8_t tmp; + rv &= network_to_native(&tmp, network); + *native = static_cast(tmp); + // TODO this is what really should be doing a checked cast + return rv; +} #endif // TMWA_PROTO2_TYPES_HPP -- cgit v1.2.3-60-g2f50