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
|
class MapFlags(object):
__slots__ = ('_value')
name = 'tmwa::map::MapFlags'
enabled = True
def __init__(self, value):
self._value = value['flags']
def to_string(self):
i = int(self._value)
s = []
for n, v in MapFlags.junk:
v = 1 << v
if i & v:
i -= v
s.append(n)
if i or not s:
s.append('%#08x' % i)
return 'MapFlags(%s)' % (' | '.join(s))
junk = [
#('ALIAS', 21),
#('NOMEMO', 0),
('NOTELEPORT', 1),
('NORETURN', 22),
('MONSTER_NOTELEPORT', 23),
('NOSAVE', 2),
#('NOBRANCH', 3),
('NOPENALTY', 4),
('PVP', 6),
('PVP_NOPARTY', 7),
#('PVP_NOGUILD', 8),
#('PVP_NIGHTMAREDROP', 24),
('PVP_NOCALCRANK', 25),
#('GVG', 9),
#('GVG_NOPARTY', 10),
#('NOZENYPENALTY', 5),
#('NOTRADE', 11),
#('NOSKILL', 12),
('NOWARP', 13),
('NOWARPTO', 26),
('NOPVP', 14),
#('NOICEWALL', 15),
('SNOW', 16),
('FOG', 17),
('SAKURA', 18),
('LEAVES', 19),
('RAIN', 20),
('NO_PLAYER_DROPS', 27),
('TOWN', 28),
('OUTSIDE', 29),
('RESAVE', 30),
]
tests = [
('reinterpret_cast<const tmwa::map::MapFlags&>(static_cast<const unsigned int&>(0x80000000))', 'MapFlags(0x80000000)'),
('reinterpret_cast<const tmwa::map::MapFlags&>(static_cast<const unsigned int&>(0xf0000000))', 'MapFlags(TOWN | OUTSIDE | RESAVE | 0x80000000)'),
] + [
('tmwa::map::MapFlags(); value.set(tmwa::map::MapFlag::%s, true)' % n, 'MapFlags(%s)' % n)
for (n, _) in junk
] + [
('reinterpret_cast<const tmwa::map::MapFlags&>(static_cast<const unsigned int&>(1 << %d))' % i, 'MapFlags(%s)' % n)
for (n, i) in junk
]
|