From edffe62dde3967f4065f5baf45d3115d574fe3cf Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 2 Mar 2023 15:15:25 -0400 Subject: TPlyGuildCardTag: Put everything upto `guildcard_number` in a union This will be needed for later. --- include/pso/TPlyGuildCardTag.h | 14 ++++++++++---- src/pso/TPlyGuildCardTag.cpp | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/pso/TPlyGuildCardTag.h b/include/pso/TPlyGuildCardTag.h index 3e193a0..a29e977 100644 --- a/include/pso/TPlyGuildCardTag.h +++ b/include/pso/TPlyGuildCardTag.h @@ -6,11 +6,17 @@ #include class TPlyGuildCardTag { - public: - u8 tag0; - u8 tag1; - u16 tag2; +public: + union { + struct { + u8 tag0; + u8 tag1; + u16 tag2; + } tag; + u32 tag_u32; + }; u32 guildcard_number; + TPlyGuildCardTag &operator=(const TPlyGuildCardTag &src); void bswap(); } __packed__; diff --git a/src/pso/TPlyGuildCardTag.cpp b/src/pso/TPlyGuildCardTag.cpp index 079fcbc..e874485 100644 --- a/src/pso/TPlyGuildCardTag.cpp +++ b/src/pso/TPlyGuildCardTag.cpp @@ -4,13 +4,13 @@ void TPlyGuildCardTag::bswap() { bswap_32(&guildcard_number); - bswap_16(&tag2); + bswap_16(&tag.tag2); } TPlyGuildCardTag &TPlyGuildCardTag::operator=(const TPlyGuildCardTag &src) { - tag0 = src.tag0; - tag1 = src.tag1; - tag2 = src.tag2; + tag.tag0 = src.tag.tag0; + tag.tag1 = src.tag.tag1; + tag.tag2 = src.tag.tag2; guildcard_number = src.guildcard_number; return *this; } -- cgit v1.2.3-13-gbd6f