summaryrefslogtreecommitdiff
path: root/include/pso
diff options
context:
space:
mode:
Diffstat (limited to 'include/pso')
-rw-r--r--include/pso/TMenuList.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/include/pso/TMenuList.h b/include/pso/TMenuList.h
index f792462..0eb35e5 100644
--- a/include/pso/TMenuList.h
+++ b/include/pso/TMenuList.h
@@ -4,6 +4,7 @@
#include "pso/forward.h"
#include "pso/protocol.h"
#include "pso/macros.h"
+#include "pso/TArray.h"
#include "pso/TPlyGuildCardTag.h"
#include <global_types.h>
@@ -20,19 +21,18 @@ template <typename T, int num_entries, int num_pad_entries>
class TMenuList {
public:
packet_header header;
- TMenuListEntry<T> pad_entries[num_pad_entries];
- TMenuListEntry<T> entries[num_entries];
+ TArray<TMenuListEntry<T>, num_pad_entries> pad_entries;
+ TArray<TMenuListEntry<T>, num_entries> entries;
void bswap();
TMenuList &operator=(const TMenuList &src);
-
} __packed__;
template <typename T, int num_entries>
class TMenuList<T, num_entries, 0> {
public:
packet_header header;
- TMenuListEntry<T> entries[num_entries];
+ TArray<TMenuListEntry<T>, num_entries> entries;
void bswap();
TMenuList &operator=(const TMenuList &src);
@@ -42,7 +42,7 @@ template <typename T, int num_pad_entries>
class TMenuList<T, 0, num_pad_entries> {
public:
packet_header header;
- TMenuListEntry<T> pad_entries[num_pad_entries];
+ TArray<TMenuListEntry<T>, num_pad_entries> pad_entries;
void bswap();
TMenuList &operator=(const TMenuList &src);
@@ -86,22 +86,17 @@ void TMenuListEntry<T>::bswap() {
entry.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;
- for (int i = 0; i < num_entries; i++) {
- entries[i] = src.entries[i];
- }
+ entries = src.entries;
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;
- for (int i = 0; i < num_pad_entries; i++) {
- pad_entries[i] = src.pad_entries[i];
- }
+ pad_entries = src.pad_entries;
return *this;
}
@@ -109,14 +104,10 @@ 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) {
- for (int i = 0; i < num_pad_entries; i++) {
- pad_entries[i] = src.pad_entries[i];
- }
+ pad_entries = src.pad_entries;
}
if (num_entries) {
- for (int i = 0; i < num_entries; i++) {
- entries[i] = src.entries[i];
- }
+ entries = src.entries;
}
return *this;
}
@@ -127,4 +118,5 @@ TMenuListEntry<T> &TMenuListEntry<T>::operator=(const TMenuListEntry<T> &src) {
entry = src.entry;
return *this;
}
+
#endif