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
|
/* $Id$ */
typedef enum UnmovableType {
UNMOVABLE_TRANSMITTER = 0,
UNMOVABLE_LIGHTHOUSE = 1,
UNMOVABLE_STATUE = 2,
UNMOVABLE_OWNED_LAND = 3
} UnmovableType;
static inline UnmovableType GetUnmovableType(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE));
return _m[t].m5;
}
static inline bool IsTransmitterTile(TileIndex t)
{
return
IsTileType(t, MP_UNMOVABLE) &&
GetUnmovableType(t) == UNMOVABLE_TRANSMITTER;
}
static inline bool IsOwnedLand(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE));
return GetUnmovableType(t) == UNMOVABLE_OWNED_LAND;
}
static inline bool IsOwnedLandTile(TileIndex t)
{
return IsTileType(t, MP_UNMOVABLE) && IsOwnedLand(t);
}
static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o)
{
SetTileType(t, MP_UNMOVABLE);
SetTileOwner(t, o);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = u;
}
static inline void MakeTransmitter(TileIndex t)
{
MakeUnmovable(t, UNMOVABLE_TRANSMITTER, OWNER_NONE);
}
static inline void MakeLighthouse(TileIndex t)
{
MakeUnmovable(t, UNMOVABLE_LIGHTHOUSE, OWNER_NONE);
}
static inline void MakeStatue(TileIndex t, Owner o)
{
MakeUnmovable(t, UNMOVABLE_STATUE, o);
}
static inline void MakeOwnedLand(TileIndex t, Owner o)
{
MakeUnmovable(t, UNMOVABLE_OWNED_LAND, o);
}
|