Mercurial > hg > openttd
annotate src/town_map.h @ 20706:79930f9362c3 draft
-Change: [Win32] Position the IME composition window at the caret position.
author | Michael Lutz <michi@icosahedron.de> |
---|---|
date | Sun, 07 Apr 2013 17:10:38 +0200 |
parents | 0dba7f49118c |
children |
rev | line source |
---|---|
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12251
diff
changeset
|
9 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** @file town_map.h Accessors for towns */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef TOWN_MAP_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define TOWN_MAP_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
12998
c71e77a71cad
(svn r17492) -Codechange: don't store the town index for road depots.
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
15 #include "road_map.h" |
12249
559350145373
(svn r16664) -Codechange: move house-related stuff from town.h and town_type.h to separate files
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
16 #include "house.h" |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
18 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
19 * Get the index of which town this house/street is attached to. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
20 * @param t the tile |
12998
c71e77a71cad
(svn r17492) -Codechange: don't store the town index for road depots.
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
21 * @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
22 * @return TownID |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
23 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 static inline TownID GetTownIndex(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 { |
12998
c71e77a71cad
(svn r17492) -Codechange: don't store the town index for road depots.
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
26 assert(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t))); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 return _m[t].m2; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 * Set the town index for a road or house tile. |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
32 * @param t the tile |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 * @param index the index of the town |
12998
c71e77a71cad
(svn r17492) -Codechange: don't store the town index for road depots.
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
34 * @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 static inline void SetTownIndex(TileIndex t, TownID index) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
37 { |
12998
c71e77a71cad
(svn r17492) -Codechange: don't store the town index for road depots.
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
38 assert(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t))); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 _m[t].m2 = index; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 |
5969
eacddbbd72d5
(svn r8651) -Codechange: group the functions related to getting and setting the town index and move one function that is not related to the map array out of town_map.h.
rubidium <rubidium@openttd.org>
parents:
5475
diff
changeset
|
42 /** |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
43 * Get the type of this house, which is an index into the house spec array |
14025
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
44 * without doing any NewGRF related translations. |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
45 * @param t the tile |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
46 * @pre IsTileType(t, MP_HOUSE) |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
47 * @return house type |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
48 */ |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
49 static inline HouseID GetCleanHouseType(TileIndex t) |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
50 { |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
51 assert(IsTileType(t, MP_HOUSE)); |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
52 return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8); |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
53 } |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
54 |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
55 /** |
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
56 * Get the type of this house, which is an index into the house spec array |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
57 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
58 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
59 * @return house type |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
60 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
61 static inline HouseID GetHouseType(TileIndex t) |
5969
eacddbbd72d5
(svn r8651) -Codechange: group the functions related to getting and setting the town index and move one function that is not related to the map array out of town_map.h.
rubidium <rubidium@openttd.org>
parents:
5475
diff
changeset
|
62 { |
14025
ec50d4cd06b5
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
rubidium <rubidium@openttd.org>
parents:
12998
diff
changeset
|
63 return GetTranslatedHouseID(GetCleanHouseType(t)); |
5969
eacddbbd72d5
(svn r8651) -Codechange: group the functions related to getting and setting the town index and move one function that is not related to the map array out of town_map.h.
rubidium <rubidium@openttd.org>
parents:
5475
diff
changeset
|
64 } |
eacddbbd72d5
(svn r8651) -Codechange: group the functions related to getting and setting the town index and move one function that is not related to the map array out of town_map.h.
rubidium <rubidium@openttd.org>
parents:
5475
diff
changeset
|
65 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
66 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
67 * Set the house type. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
68 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
69 * @param house_id the new house type |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
70 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
71 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
72 static inline void SetHouseType(TileIndex t, HouseID house_id) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
73 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
74 assert(IsTileType(t, MP_HOUSE)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
75 _m[t].m4 = GB(house_id, 0, 8); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
76 SB(_m[t].m3, 6, 1, GB(house_id, 8, 1)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
77 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
78 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
79 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
80 * Check if the lift of this animated house has a destination |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
81 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
82 * @return has destination |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
83 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
84 static inline bool LiftHasDestination(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
85 { |
7928
4e8dfd103163
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7922
diff
changeset
|
86 return HasBit(_me[t].m7, 0); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
87 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
88 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
89 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
90 * Set the new destination of the lift for this animated house, and activate |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
91 * the LiftHasDestination bit. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
92 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
93 * @param dest new destination |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
94 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
95 static inline void SetLiftDestination(TileIndex t, byte dest) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
96 { |
7931
44ff7a6d801f
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7928
diff
changeset
|
97 SetBit(_me[t].m7, 0); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
98 SB(_me[t].m7, 1, 3, dest); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
99 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
100 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
101 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
102 * Get the current destination for this lift |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
103 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
104 * @return destination |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
105 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
106 static inline byte GetLiftDestination(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
107 { |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
108 return GB(_me[t].m7, 1, 3); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
109 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
110 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
111 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
112 * Stop the lift of this animated house from moving. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
113 * Clears the first 4 bits of m7 at once, clearing the LiftHasDestination bit |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
114 * and the destination. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
115 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
116 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
117 static inline void HaltLift(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
118 { |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
119 SB(_me[t].m7, 0, 4, 0); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
120 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
121 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
122 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
123 * Get the position of the lift on this animated house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
124 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
125 * @return position, from 0 to 36 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
126 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
127 static inline byte GetLiftPosition(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
128 { |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
129 return GB(_m[t].m6, 2, 6); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
130 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
131 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
132 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
133 * Set the position of the lift on this animated house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
134 * @param t the tile |
6422
fb10eafe2a26
(svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas <belugas@openttd.org>
parents:
6418
diff
changeset
|
135 * @param pos position, from 0 to 36 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
136 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
137 static inline void SetLiftPosition(TileIndex t, byte pos) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
138 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
139 SB(_m[t].m6, 2, 6, pos); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
140 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
141 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
142 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
143 * Get the completion of this house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
144 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
145 * @return true if it is, false if it is not |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
146 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
147 static inline bool IsHouseCompleted(TileIndex t) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
148 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
149 assert(IsTileType(t, MP_HOUSE)); |
7928
4e8dfd103163
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7922
diff
changeset
|
150 return HasBit(_m[t].m3, 7); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
151 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
152 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
153 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
154 * Mark this house as been completed |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
155 * @param t the tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
156 * @param status |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
157 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
158 static inline void SetHouseCompleted(TileIndex t, bool status) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
159 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
160 assert(IsTileType(t, MP_HOUSE)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
161 SB(_m[t].m3, 7, 1, !!status); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
162 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
163 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
164 /** |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 * House Construction Scheme. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 * Construction counter, for buildings under construction. Incremented on every |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
167 * periodic tile processing. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 * On wraparound, the stage of building in is increased. |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
169 * GetHouseBuildingStage is taking care of the real stages, |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 * (as the sprite for the next phase of house building) |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
171 * (Get|Inc)HouseConstructionTick is simply a tick counter between the |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 * different stages |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
173 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
175 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
176 * Gets the building stage of a house |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
177 * Since the stage is used for determining what sprite to use, |
19968
0dba7f49118c
(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow)
planetmaker <planetmaker@openttd.org>
parents:
15934
diff
changeset
|
178 * if the house is complete (and that stage no longer is available), |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
179 * fool the system by returning the TOWN_HOUSE_COMPLETE (3), |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
180 * thus showing a beautiful complete house. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
181 * @param t the tile of the house to get the building stage of |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
182 * @pre IsTileType(t, MP_HOUSE) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 * @return the building stage of the house |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
184 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
185 static inline byte GetHouseBuildingStage(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
186 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 assert(IsTileType(t, MP_HOUSE)); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
188 return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
189 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 * Gets the construction stage of a house |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
193 * @param t the tile of the house to get the construction stage of |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 * @pre IsTileType(t, MP_HOUSE) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
195 * @return the construction stage of the house |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
196 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 static inline byte GetHouseConstructionTick(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
199 assert(IsTileType(t, MP_HOUSE)); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
200 return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
201 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
204 * Sets the increment stage of a house |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
205 * It is working with the whole counter + stage 5 bits, making it |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
206 * easier to work: the wraparound is automatic. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
207 * @param t the tile of the house to increment the construction stage of |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
208 * @pre IsTileType(t, MP_HOUSE) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
210 static inline void IncHouseConstructionTick(TileIndex t) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
211 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
212 assert(IsTileType(t, MP_HOUSE)); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
213 AB(_m[t].m5, 0, 5, 1); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
214 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
215 if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
216 /* House is now completed. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
217 * Store the year of construction as well, for newgrf house purpose */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
218 SetHouseCompleted(t, true); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
219 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
220 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
221 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
222 /** |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
223 * Sets the age of the house to zero. |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
224 * Needs to be called after the house is completed. During construction stages the map space is used otherwise. |
9006
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
225 * @param t the tile of this house |
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
226 * @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t) |
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
227 */ |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
228 static inline void ResetHouseAge(TileIndex t) |
9006
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
229 { |
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
230 assert(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)); |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
231 _m[t].m5 = 0; |
9006
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
232 } |
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
233 |
9bf1de259ada
(svn r12801) -Codechange: remove the dependency of function.h in town_map.h
rubidium <rubidium@openttd.org>
parents:
9005
diff
changeset
|
234 /** |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
235 * Increments the age of the house. |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
236 * @param t the tile of this house |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
237 * @pre IsTileType(t, MP_HOUSE) |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
238 */ |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
239 static inline void IncrementHouseAge(TileIndex t) |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
240 { |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
241 assert(IsTileType(t, MP_HOUSE)); |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
242 if (IsHouseCompleted(t) && _m[t].m5 < 0xFF) _m[t].m5++; |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
243 } |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
244 |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
245 /** |
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
246 * Get the age of the house |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
247 * @param t the tile of this house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
248 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
249 * @return year |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
250 */ |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
251 static inline Year GetHouseAge(TileIndex t) |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
252 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
253 assert(IsTileType(t, MP_HOUSE)); |
10360
d352cf399eb7
(svn r14611) -Fix (r13437)[FS#2421]: Store the age of a house in the map array instead of the construction year.
frosch <frosch@openttd.org>
parents:
10357
diff
changeset
|
254 return IsHouseCompleted(t) ? _m[t].m5 : 0; |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
255 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
256 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
257 /** |
7861
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
258 * Set the random bits for this house. |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
259 * This is required for newgrf house |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
260 * @param t the tile of this house |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
261 * @param random the new random bits |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
262 * @pre IsTileType(t, MP_HOUSE) |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
263 */ |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
264 static inline void SetHouseRandomBits(TileIndex t, byte random) |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
265 { |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
266 assert(IsTileType(t, MP_HOUSE)); |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
267 _m[t].m1 = random; |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
268 } |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
269 |
6986bc3b90e4
(svn r11411) -Codechange: implement random triggers for houses.
rubidium <rubidium@openttd.org>
parents:
7370
diff
changeset
|
270 /** |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
271 * Get the random bits for this house. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
272 * This is required for newgrf house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
273 * @param t the tile of this house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
274 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
275 * @return random bits |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
276 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
277 static inline byte GetHouseRandomBits(TileIndex t) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
278 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
279 assert(IsTileType(t, MP_HOUSE)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
280 return _m[t].m1; |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
281 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
282 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
283 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
284 * Set the activated triggers bits for this house. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
285 * This is required for newgrf house |
6418
c8862595d06b
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents:
6332
diff
changeset
|
286 * @param t the tile of this house |
c8862595d06b
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents:
6332
diff
changeset
|
287 * @param triggers the activated triggers |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
288 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
289 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
290 static inline void SetHouseTriggers(TileIndex t, byte triggers) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
291 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
292 assert(IsTileType(t, MP_HOUSE)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
293 SB(_m[t].m3, 0, 5, triggers); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
294 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
295 |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
296 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
297 * Get the already activated triggers bits for this house. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
298 * This is required for newgrf house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
299 * @param t the tile of this house |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
300 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
301 * @return triggers |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
302 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
303 static inline byte GetHouseTriggers(TileIndex t) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
304 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
305 assert(IsTileType(t, MP_HOUSE)); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
306 return GB(_m[t].m3, 0, 5); |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
307 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
308 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
309 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
310 * Get the amount of time remaining before the tile loop processes this tile. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
311 * @param t the house tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
312 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
313 * @return time remaining |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
314 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
315 static inline byte GetHouseProcessingTime(TileIndex t) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
316 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
317 assert(IsTileType(t, MP_HOUSE)); |
15933
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
318 return GB(_m[t].m6, 2, 6); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
319 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
320 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
321 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
322 * Set the amount of time remaining before the tile loop processes this tile. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
323 * @param t the house tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
324 * @param time the time to be set |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
325 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
326 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
327 static inline void SetHouseProcessingTime(TileIndex t, byte time) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
328 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
329 assert(IsTileType(t, MP_HOUSE)); |
15933
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
330 SB(_m[t].m6, 2, 6, time); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
331 } |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
332 |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
333 /** |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
334 * Decrease the amount of time remaining before the tile loop processes this tile. |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
335 * @param t the house tile |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
336 * @pre IsTileType(t, MP_HOUSE) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
337 */ |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
338 static inline void DecHouseProcessingTime(TileIndex t) |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
339 { |
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
340 assert(IsTileType(t, MP_HOUSE)); |
15933
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
341 _m[t].m6 -= 1 << 2; |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
342 } |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
343 |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
344 /** |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
345 * Make the tile a house. |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
346 * @param t tile index |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
347 * @param tid Town index |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
348 * @param counter of construction step |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
349 * @param stage of construction (used for drawing) |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
350 * @param type of house. Index into house specs array |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
351 * @param random_bits required for newgrf houses |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
352 * @pre IsTileType(t, MP_CLEAR) |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
353 */ |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
354 static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits) |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
355 { |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
356 assert(IsTileType(t, MP_CLEAR)); |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
357 |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
358 SetTileType(t, MP_HOUSE); |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
359 _m[t].m1 = random_bits; |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
360 _m[t].m2 = tid; |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
361 _m[t].m3 = 0; |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
362 SetHouseType(t, type); |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
363 SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED); |
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
364 _m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter); |
15934
3172190fa127
(svn r20622) -Codechange: unify [GS]et[Statation|Object|Industry|House]AnimationFrame
rubidium <rubidium@openttd.org>
parents:
15933
diff
changeset
|
365 SetAnimationFrame(t, 0); |
15933
8ac5258d7680
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
366 SetHouseProcessingTime(t, HouseSpec::Get(type)->processing_time); |
6332
60486b0b3e39
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros <maedhros@openttd.org>
parents:
5969
diff
changeset
|
367 } |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
368 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
369 #endif /* TOWN_MAP_H */ |