blob: c7523412163c3dbf3e9802a5bd2c73ba74a1a956 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#ifndef TMENULIST_H
#define TMENULIST_H
#include "pso/forward.h"
#include "pso/protocol.h"
#include "pso/macros.h"
#include "pso/TPlyGuildCardTag.h"
#include <global_types.h>
#define TMenuListEntry(name, members) \
class name { \
public: \
void bswap() { \
tag.bswap(); \
}; \
public: \
TPlyGuildCardTag tag; \
members \
} __packed__
template <typename T, int num_entries, int num_pad_entries>
class TMenuList {
public:
void bswap() {
header.bswap();
if (num_pad_entries) {
for (int i = 0; i < num_pad_entries; i++) {
pad_entries[i].bswap();
}
}
if (num_entries) {
for (int i = 0; i < num_entries; i++) {
entries[i].bswap();
}
}
};
public:
packet_header header;
T pad_entries[num_pad_entries];
T entries[num_entries];
} __packed__;
#ifdef __MWERKS__
template <typename T, int num_entries>
class TMenuList<T, num_entries, 0> {
public:
void bswap() {
header.bswap();
for (int i = 0; i < num_entries; i++) {
entries[i].bswap();
}
};
public:
packet_header header;
T entries[num_entries];
} __packed__;
template <typename T, int num_pad_entries>
class TMenuList<T, 0, num_pad_entries> {
public:
void bswap() {
header.bswap();
for (int i = 0; i < num_pad_entries; i++) {
pad_entries[i].bswap();
}
};
public:
packet_header header;
T pad_entries[num_pad_entries];
} __packed__;
#endif
#endif
|