diff options
Diffstat (limited to 'src/proto2/map-user.hpp')
-rw-r--r-- | src/proto2/map-user.hpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp index da59c40..90102f7 100644 --- a/src/proto2/map-user.hpp +++ b/src/proto2/map-user.hpp @@ -7,16 +7,16 @@ // This file is part of The Mana World (Athena server) // // This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by +// it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // This is a generated file, edit tools/protocol.py instead @@ -27,36 +27,41 @@ // This is a public protocol, and changes require client cooperation -struct SPacket0x0212_Fixed +struct SPacket_0x0212_Fixed { - uint16_t packet_id; - BlockId npc_id; - uint16_t command; - BlockId id; - uint16_t x; - uint16_t y; + using NetType = NetSPacket_0x0212_Fixed; + static const uint16_t PACKET_ID = 0x0212; + + uint16_t magic_packet_id = PACKET_ID; + BlockId npc_id = {}; + uint16_t command = {}; + BlockId id = {}; + uint16_t x = {}; + uint16_t y = {}; }; -struct NetSPacket0x0212_Fixed + +struct NetSPacket_0x0212_Fixed { - Little16 packet_id; + Little16 magic_packet_id; Little32 npc_id; Little16 command; Little32 id; Little16 x; Little16 y; }; -static_assert(offsetof(NetSPacket0x0212_Fixed, packet_id) == 0, "offsetof(NetSPacket0x0212_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket0x0212_Fixed, npc_id) == 2"); -static_assert(offsetof(NetSPacket0x0212_Fixed, command) == 6, "offsetof(NetSPacket0x0212_Fixed, command) == 6"); -static_assert(offsetof(NetSPacket0x0212_Fixed, id) == 8, "offsetof(NetSPacket0x0212_Fixed, id) == 8"); -static_assert(offsetof(NetSPacket0x0212_Fixed, x) == 12, "offsetof(NetSPacket0x0212_Fixed, x) == 12"); -static_assert(offsetof(NetSPacket0x0212_Fixed, y) == 14, "offsetof(NetSPacket0x0212_Fixed, y) == 14"); -static_assert(sizeof(NetSPacket0x0212_Fixed) == 16, "sizeof(NetSPacket0x0212_Fixed) == 16"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x0212_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket_0x0212_Fixed, npc_id) == 2"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, command) == 6, "offsetof(NetSPacket_0x0212_Fixed, command) == 6"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, id) == 8, "offsetof(NetSPacket_0x0212_Fixed, id) == 8"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, x) == 12, "offsetof(NetSPacket_0x0212_Fixed, x) == 12"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, y) == 14, "offsetof(NetSPacket_0x0212_Fixed, y) == 14"); +static_assert(sizeof(NetSPacket_0x0212_Fixed) == 16, "sizeof(NetSPacket_0x0212_Fixed) == 16"); + inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed native) +bool native_to_network(NetSPacket_0x0212_Fixed *network, SPacket_0x0212_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->npc_id, native.npc_id); rv &= native_to_network(&network->command, native.command); rv &= native_to_network(&network->id, native.id); @@ -65,10 +70,10 @@ bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed nati return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed network) +bool network_to_native(SPacket_0x0212_Fixed *native, NetSPacket_0x0212_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->npc_id, network.npc_id); rv &= network_to_native(&native->command, network.command); rv &= network_to_native(&native->id, network.id); @@ -77,5 +82,4 @@ bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed netwo return rv; } - #endif // TMWA_PROTO2_MAP_USER_HPP |