diff options
Diffstat (limited to 'include/pso/TPlyInventory.h')
-rw-r--r-- | include/pso/TPlyInventory.h | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h index 3256717..eb9564b 100644 --- a/include/pso/TPlyInventory.h +++ b/include/pso/TPlyInventory.h @@ -6,12 +6,28 @@ #include <pso/protocol.h> struct TItemData { - void init(); - void bswap(); - TItemData &assign(const TItemData &src); + void init() { + data1.data_u8[0] = 0; + data1.data_u8[1] = 0; + data1.data_u8[2] = 0; + data1.data_u8[3] = 0; + data1.data_u8[4] = 0; + data1.data_u8[5] = 0; + data2.data_u32 = 0; + for (int i = 0; i < 3; ++i) { + data1.data_u8_pair[3+i][0] = 0; + data1.data_u8_pair[3+i][1] = 0; + } + id = -1; + }; + void bswap() { + bswap_32(&data2.data_u32); + bswap_32(&id); + }; union { u8 data_u8[12]; + u8 data_u8_pair[6][2]; u16 data_u16[6]; u32 data_u32[3]; } data1; @@ -25,11 +41,20 @@ struct TItemData { class TPlyInventoryItem { public: - void init(); - void bswap(); - TPlyInventoryItem &assign(const TPlyInventoryItem &src); + void init() { + m_present[0] = 0; + m_present[1] = -1; + m_flags = 0; + m_present[3] = 0; + m_present[2] = 0; + m_data.init(); + }; + void bswap() { + bswap_32(&m_flags); + m_data.bswap(); + }; public: - u8 m_present[4]; + char m_present[4]; u32 m_flags; TItemData m_data; }; @@ -37,7 +62,6 @@ public: class TPlyInventory { public: void bswap(); - TPlyInventory &assign(const TPlyInventory &src); public: u8 m_num_items; u8 m_hp_materials_used; |