diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-22 15:34:08 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-22 15:34:49 -0300 |
commit | 0b0f3da43d281b75cc04a9333332f2abc1eff0c7 (patch) | |
tree | 7d7aaf7326b6501383c66d8fbc0341f47bed1fea /include/pso/packet_classes.h | |
parent | 769c041207521e8b5fd46a616b499fe21088c9a7 (diff) |
TProtocol: Add (and match) more command senders
Diffstat (limited to 'include/pso/packet_classes.h')
-rw-r--r-- | include/pso/packet_classes.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/pso/packet_classes.h b/include/pso/packet_classes.h index 98f45bc..268ac40 100644 --- a/include/pso/packet_classes.h +++ b/include/pso/packet_classes.h @@ -83,6 +83,53 @@ union game_command_union { u8 bytes[1024]; }; +template<int action_type = 0> +class TSendAction { +public: + packet_header header; + TPlyGuildCardTag tag; + #if defined(__GNUC__) || defined(__clang__) + char name[(action_type & 1) ? 16 : 0]; + char password[(action_type & 2) ? 16 : 0]; + #endif +public: + void bswap() { + header.bswap(); + tag.bswap(); + }; +}; + +#if !defined(__GNUC__) && !defined(__clang__) +#define _TSendAction(action_type, members) \ +template<> \ +class TSendAction<action_type> { \ +public: \ + packet_header header; \ + TPlyGuildCardTag tag; \ + members \ +public: \ + void bswap() { \ + header.bswap(); \ + tag.bswap(); \ + }; \ +} + +_TSendAction(1, + char name[16]; +); + +_TSendAction(2, + char password[16]; +); + +_TSendAction(3, + char name[16]; + char password[16]; +); + +#undef _TSendAction +#endif + class TRegister { public: packet_header header; |