diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TPlyInventory.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h new file mode 100644 index 0000000..6143a06 --- /dev/null +++ b/include/pso/TPlyInventory.h @@ -0,0 +1,61 @@ +#ifndef TPLYINVENTORY_H +#define TPLYINVENTORY_H + +#include <global_types.h> +#include <pso/macros.h> +#include <pso/protocol.h> +#include <pso/TArray.h> + +struct TItemData { + TItemData(); + void bswap(); + TItemData &assign(const TItemData &src); + + union { + TArray<u8, 12> data_u8; + TArray<u16, 6> data_u16; + TArray<u32, 3> data_u32; + } data1; + u32 id; + union { + TArray<u8, 4> data_u8; + TArray<u8, 2> data_u16; + u32 data_u32; + } data2; +}; + +class TPlyInventoryItem { +public: + TPlyInventoryItem() {}; + + void bswap(); + TPlyInventoryItem &assign(const TPlyInventoryItem &src); + + PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, present, 4); + PRIVATE_MEMBER_ACCESSORS(u32, flags); + PRIVATE_MEMBER_ACCESSORS(TItemData, data); +private: + TArray<u8, 4> m_present; + u32 m_flags; + TItemData m_data; +}; + +class TPlyInventory { +public: + void bswap(); + TPlyInventory &assign(const TPlyInventory &src); + + PRIVATE_MEMBER_ACCESSORS(u8, num_items); + PRIVATE_MEMBER_ACCESSORS(u8, hp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, tp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, language); + PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyInventoryItem, items, 30); +private: + u8 m_num_items; + u8 m_hp_materials_used; + u8 m_tp_materials_used; + u8 m_language; + TArray<TPlyInventoryItem, 30> m_items; +}; + +#endif |