summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-02 15:29:37 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-02 15:29:37 -0400
commit83532988dbc1ef4ea96afb9975c1872dba3494ad (patch)
treea90fe9bef71c449a0674c0931a23a3241923bbc3 /include
parent7add9178473b74f5a922997d93bbca7d09e6a5c5 (diff)
TMenuList, TPlyGuildCardTag: Actually match both classes
Didn't realize that `TMenuList`'s `operator=` was actually implicit.
Diffstat (limited to 'include')
-rw-r--r--include/pso/TMenuList.h45
-rw-r--r--include/pso/TPlyGuildCardTag.h11
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;