summaryrefslogtreecommitdiff
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
parent7add9178473b74f5a922997d93bbca7d09e6a5c5 (diff)
TMenuList, TPlyGuildCardTag: Actually match both classes
Didn't realize that `TMenuList`'s `operator=` was actually implicit.
-rw-r--r--context.h56
-rw-r--r--include/pso/TMenuList.h45
-rw-r--r--include/pso/TPlyGuildCardTag.h11
-rw-r--r--src/pso/TPlyGuildCardTag.cpp12
4 files changed, 74 insertions, 50 deletions
diff --git a/context.h b/context.h
index b268acf..cf894ab 100644
--- a/context.h
+++ b/context.h
@@ -334,7 +334,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>
@@ -345,7 +353,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>
@@ -355,7 +363,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>
@@ -365,7 +373,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__;
@@ -407,36 +415,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;
}
// TMainTask.cpp
@@ -618,14 +623,21 @@ static inline void operator|=(object_flags &a, object_flags b) { a = a | b; };
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;
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;
diff --git a/src/pso/TPlyGuildCardTag.cpp b/src/pso/TPlyGuildCardTag.cpp
index 61bed28..d1341c5 100644
--- a/src/pso/TPlyGuildCardTag.cpp
+++ b/src/pso/TPlyGuildCardTag.cpp
@@ -7,10 +7,10 @@ void TPlyGuildCardTag::bswap() {
bswap_16(&m_tag.tag2);
}
-TPlyGuildCardTag &TPlyGuildCardTag::operator=(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();
- return *this;
+void TPlyGuildCardTag::assign(const TPlyGuildCardTag &src) {
+ _assign(src);
+}
+
+void TPlyGuildCardTag::assign(const TPlyGuildCardTag *src) {
+ _assign(*src);
}