diff options
Diffstat (limited to 'include/pso')
-rw-r--r-- | include/pso/TMenuList.h | 45 | ||||
-rw-r--r-- | include/pso/TPlyGuildCardTag.h | 11 |
2 files changed, 34 insertions, 22 deletions
diff --git a/include/pso/TMenuList.h b/include/pso/TMenuList.h index 0eb35e5..54ca441 100644 --- a/include/pso/TMenuList.h +++ b/include/pso/TMenuList.h @@ -14,7 +14,15 @@ class TMenuListEntry : public TPlyGuildCardTag { T entry; void bswap(); - TMenuListEntry &operator=(const TMenuListEntry &src); + void assign(const TMenuListEntry &src); + + TMenuListEntry &operator=(const TMenuListEntry &src) { + _assign(src); + return *this; + }; + + private: + void _assign(const TMenuListEntry &src); } __packed__; template <typename T, int num_entries, int num_pad_entries> @@ -25,7 +33,7 @@ class TMenuList { TArray<TMenuListEntry<T>, num_entries> entries; void bswap(); - TMenuList &operator=(const TMenuList &src); + TMenuList &assign(const TMenuList &src); } __packed__; template <typename T, int num_entries> @@ -35,7 +43,7 @@ class TMenuList<T, num_entries, 0> { TArray<TMenuListEntry<T>, num_entries> entries; void bswap(); - TMenuList &operator=(const TMenuList &src); + TMenuList &assign(const TMenuList &src); } __packed__; template <typename T, int num_pad_entries> @@ -45,7 +53,7 @@ class TMenuList<T, 0, num_pad_entries> { TArray<TMenuListEntry<T>, num_pad_entries> pad_entries; void bswap(); - TMenuList &operator=(const TMenuList &src); + TMenuList &assign(const TMenuList &src); } __packed__; @@ -87,36 +95,33 @@ void TMenuListEntry<T>::bswap() { } template <typename T, int num_entries> -TMenuList<T, num_entries, 0> &TMenuList<T, num_entries, 0>::operator=(const TMenuList<T, num_entries, 0> &src) { - header = src.header; - entries = src.entries; +TMenuList<T, num_entries, 0> &TMenuList<T, num_entries, 0>::assign(const TMenuList<T, num_entries, 0> &src) { + *this = src; return *this; } template <typename T, int num_pad_entries> -TMenuList<T, 0, num_pad_entries> &TMenuList<T, 0, num_pad_entries>::operator=(const TMenuList<T, 0, num_pad_entries> &src) { - header = src.header; - pad_entries = src.pad_entries; +TMenuList<T, 0, num_pad_entries> &TMenuList<T, 0, num_pad_entries>::assign(const TMenuList<T, 0, num_pad_entries> &src) { + *this = src; return *this; } template <typename T, int num_entries, int num_pad_entries> -TMenuList<T, num_entries, num_pad_entries> &TMenuList<T, num_entries, num_pad_entries>::operator=(const TMenuList<T, num_entries, num_pad_entries> &src) { - header = src.header; - if (num_pad_entries) { - pad_entries = src.pad_entries; - } - if (num_entries) { - entries = src.entries; - } +TMenuList<T, num_entries, num_pad_entries> &TMenuList<T, num_entries, num_pad_entries>::assign(const TMenuList<T, num_entries, num_pad_entries> &src) { + *this = src; return *this; } template <typename T> -TMenuListEntry<T> &TMenuListEntry<T>::operator=(const TMenuListEntry<T> &src) { +void TMenuListEntry<T>::_assign(const TMenuListEntry<T> &src) { + TPlyGuildCardTag::assign(src); + entry = src.entry; +} + +template <typename T> +void TMenuListEntry<T>::assign(const TMenuListEntry<T> &src) { TPlyGuildCardTag::operator=(src); entry = src.entry; - return *this; } #endif diff --git a/include/pso/TPlyGuildCardTag.h b/include/pso/TPlyGuildCardTag.h index 57c30c5..f10b8e4 100644 --- a/include/pso/TPlyGuildCardTag.h +++ b/include/pso/TPlyGuildCardTag.h @@ -13,14 +13,21 @@ struct gc_tag { class TPlyGuildCardTag { public: - TPlyGuildCardTag &operator=(const TPlyGuildCardTag &src); void bswap(); + void assign(const TPlyGuildCardTag &src); + void assign(const TPlyGuildCardTag *src); PRIVATE_MEMBER_ACCESSORS(gc_tag, tag); PRIVATE_MEMBER_ACCESSORS(u32, tag_u32); PRIVATE_MEMBER_ACCESSORS(u32, guildcard_number); - private: + void _assign(const TPlyGuildCardTag &src) { + m_tag.tag0 = src.tag().tag0; + m_tag.tag1 = src.tag().tag1; + m_tag.tag2 = src.tag().tag2; + m_guildcard_number = src.guildcard_number(); + }; + union { gc_tag m_tag; u32 m_tag_u32; |