equal
deleted
inserted
replaced
4 |
4 |
5 #ifndef TOWN_MAP_H |
5 #ifndef TOWN_MAP_H |
6 #define TOWN_MAP_H |
6 #define TOWN_MAP_H |
7 |
7 |
8 #include "town.h" |
8 #include "town.h" |
9 |
|
10 static inline int GetHouseType(TileIndex t) |
|
11 { |
|
12 assert(IsTileType(t, MP_HOUSE)); |
|
13 return _m[t].m4; |
|
14 } |
|
15 |
9 |
16 static inline TownID GetTownIndex(TileIndex t) |
10 static inline TownID GetTownIndex(TileIndex t) |
17 { |
11 { |
18 assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_STREET)); // XXX incomplete |
12 assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_STREET)); // XXX incomplete |
19 return _m[t].m2; |
13 return _m[t].m2; |
21 |
15 |
22 /** |
16 /** |
23 * Set the town index for a road or house tile. |
17 * Set the town index for a road or house tile. |
24 * @param tile the tile |
18 * @param tile the tile |
25 * @param index the index of the town |
19 * @param index the index of the town |
|
20 * @pre IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE) |
26 */ |
21 */ |
27 static inline void SetTownIndex(TileIndex t, TownID index) |
22 static inline void SetTownIndex(TileIndex t, TownID index) |
28 { |
23 { |
29 assert(IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE)); |
24 assert(IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE)); |
30 _m[t].m2 = index; |
25 _m[t].m2 = index; |
|
26 } |
|
27 |
|
28 /** |
|
29 * Gets the town associated with the house or road tile |
|
30 * @param t the tile to get the town of |
|
31 * @return the town |
|
32 */ |
|
33 static inline Town* GetTownByTile(TileIndex t) |
|
34 { |
|
35 return GetTown(GetTownIndex(t)); |
|
36 } |
|
37 |
|
38 |
|
39 static inline int GetHouseType(TileIndex t) |
|
40 { |
|
41 assert(IsTileType(t, MP_HOUSE)); |
|
42 return _m[t].m4; |
31 } |
43 } |
32 |
44 |
33 static inline bool LiftHasDestination(TileIndex t) |
45 static inline bool LiftHasDestination(TileIndex t) |
34 { |
46 { |
35 return HASBIT(_m[t].m5, 7); |
47 return HASBIT(_m[t].m5, 7); |
72 |
84 |
73 static inline void SetLiftPosition(TileIndex t, byte pos) |
85 static inline void SetLiftPosition(TileIndex t, byte pos) |
74 { |
86 { |
75 SB(_m[t].m1, 0, 7, pos); |
87 SB(_m[t].m1, 0, 7, pos); |
76 } |
88 } |
77 |
|
78 static inline Town* GetTownByTile(TileIndex t) |
|
79 { |
|
80 return GetTown(GetTownIndex(t)); |
|
81 } |
|
82 |
|
83 |
|
84 Town* CalcClosestTownFromTile(TileIndex tile, uint threshold); |
|
85 |
|
86 |
89 |
87 static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, byte type) |
90 static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, byte type) |
88 { |
91 { |
89 assert(IsTileType(t, MP_CLEAR)); |
92 assert(IsTileType(t, MP_CLEAR)); |
90 |
93 |