author | rubidium |
Fri, 09 Feb 2007 16:21:03 +0000 | |
changeset 6220 | 0c2371b1edda |
parent 5726 | 8f399788f6c9 |
child 6303 | 84c215fc8eb8 |
permissions | -rw-r--r-- |
3319
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
2 |
|
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
3 |
/** @file town_map.h Accessors for towns */ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
4 |
|
3426
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
5 |
#ifndef TOWN_MAP_H |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
6 |
#define TOWN_MAP_H |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
7 |
|
3319
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
8 |
#include "town.h" |
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
9 |
|
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
10 |
static inline TownID GetTownIndex(TileIndex t) |
3319
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
11 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3319
diff
changeset
|
12 |
assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_STREET)); // XXX incomplete |
3319
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
13 |
return _m[t].m2; |
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
14 |
} |
7d04847e4689
(svn r4085) Add GetTown{Index,ByTile}() to get the town index resp. the town from a tile
tron
parents:
diff
changeset
|
15 |
|
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
16 |
/** |
3983
d2d6496238e4
(svn r5171) Get rid of an ungly hack in the load routine, which temporarily turned house and road tiles into void tiles to calculate the closest town
tron
parents:
3432
diff
changeset
|
17 |
* Set the town index for a road or house tile. |
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
18 |
* @param tile the tile |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
19 |
* @param index the index of the town |
6220
0c2371b1edda
(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
parents:
5726
diff
changeset
|
20 |
* @pre IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE) |
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
21 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
22 |
static inline void SetTownIndex(TileIndex t, TownID index) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
23 |
{ |
3983
d2d6496238e4
(svn r5171) Get rid of an ungly hack in the load routine, which temporarily turned house and road tiles into void tiles to calculate the closest town
tron
parents:
3432
diff
changeset
|
24 |
assert(IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE)); |
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
25 |
_m[t].m2 = index; |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
26 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
27 |
|
6220
0c2371b1edda
(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
parents:
5726
diff
changeset
|
28 |
/** |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
29 |
* Gets the town associated with the house or road tile |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
30 |
* @param t the tile to get the town of |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
31 |
* @return the town |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
32 |
*/ |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
33 |
static inline Town* GetTownByTile(TileIndex t) |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
34 |
{ |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
35 |
return GetTown(GetTownIndex(t)); |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
36 |
} |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
37 |
|
0c2371b1edda
(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
parents:
5726
diff
changeset
|
38 |
|
0c2371b1edda
(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
parents:
5726
diff
changeset
|
39 |
static inline int GetHouseType(TileIndex t) |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
40 |
{ |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
41 |
assert(IsTileType(t, MP_HOUSE)); |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
42 |
return _m[t].m4; |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
43 |
} |
0c2371b1edda
(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
parents:
5726
diff
changeset
|
44 |
|
3426
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
45 |
static inline bool LiftHasDestination(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
46 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
47 |
return HASBIT(_m[t].m5, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
48 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
49 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
50 |
static inline void SetLiftDestination(TileIndex t, byte dest) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
51 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
52 |
SB(_m[t].m5, 0, 6, dest); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
53 |
SETBIT(_m[t].m1, 7); /* Start moving */ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
54 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
55 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
56 |
static inline byte GetLiftDestination(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
57 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
58 |
return GB(_m[t].m5, 0, 6); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
59 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
60 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
61 |
static inline bool IsLiftMoving(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
62 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
63 |
return HASBIT(_m[t].m1, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
64 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
65 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
66 |
static inline void BeginLiftMovement(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
67 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
68 |
SETBIT(_m[t].m5, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
69 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
70 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
71 |
static inline void HaltLift(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
72 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
73 |
CLRBIT(_m[t].m1, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
74 |
CLRBIT(_m[t].m5, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
75 |
SB(_m[t].m5, 0, 6, 0); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
76 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
77 |
DeleteAnimatedTile(t); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
78 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
79 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
80 |
static inline byte GetLiftPosition(TileIndex t) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
81 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
82 |
return GB(_m[t].m1, 0, 7); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
83 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
84 |
|
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
85 |
static inline void SetLiftPosition(TileIndex t, byte pos) |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
86 |
{ |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
87 |
SB(_m[t].m1, 0, 7, pos); |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
88 |
} |
dab412dcee39
(svn r4254) -Codechange: Add and make use of map accessors for town lifts.
celestar
parents:
3382
diff
changeset
|
89 |
|
3382
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
90 |
static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, byte type) |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
91 |
{ |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
92 |
assert(IsTileType(t, MP_CLEAR)); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
93 |
|
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
94 |
SetTileType(t, MP_HOUSE); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
95 |
_m[t].m1 = 0; |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
96 |
_m[t].m2 = tid; |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
97 |
SB(_m[t].m3, 6, 2, stage); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
98 |
_m[t].m4 = type; |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
99 |
SB(_m[t].m5, 0, 2, counter); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
100 |
|
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
101 |
MarkTileDirtyByTile(t); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
102 |
} |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
103 |
|
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
104 |
enum { |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
105 |
TWO_BY_TWO_BIT = 2, ///< House is two tiles in X and Y directions |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
106 |
ONE_BY_TWO_BIT = 1, ///< House is two tiles in Y direction |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
107 |
TWO_BY_ONE_BIT = 0, ///< House is two tiles in X direction |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
108 |
}; |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
109 |
|
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
110 |
static inline void MakeTownHouse(TileIndex t, TownID tid, byte counter, byte stage, byte size, byte type) |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
111 |
{ |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
112 |
MakeHouseTile(t, tid, counter, stage, type); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
113 |
if (HASBIT(size, TWO_BY_TWO_BIT) || HASBIT(size, ONE_BY_TWO_BIT)) MakeHouseTile(t + TileDiffXY(0, 1), tid, counter, stage, ++type); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
114 |
if (HASBIT(size, TWO_BY_TWO_BIT) || HASBIT(size, TWO_BY_ONE_BIT)) MakeHouseTile(t + TileDiffXY(1, 0), tid, counter, stage, ++type); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
115 |
if (HASBIT(size, TWO_BY_TWO_BIT)) MakeHouseTile(t + TileDiffXY(1, 1), tid, counter, stage, ++type); |
c9c8d85aa632
(svn r4190) -Codechange: Add and make use of an accessor function to create houses
celestar
parents:
3377
diff
changeset
|
116 |
} |
3432
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
117 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
118 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
119 |
* House Construction Scheme. |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
120 |
* Construction counter, for buildings under construction. Incremented on every |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
121 |
* periodic tile processing. |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
122 |
* On wraparound, the stage of building in is increased. |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
123 |
* (Get|Set|Inc)HouseBuildingStage are taking care of the real stages, |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
124 |
* (as the sprite for the next phase of house building) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
125 |
* (Get|Set|Inc)HouseConstructionTick is simply a tick counter between the |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
126 |
* different stages |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
127 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
128 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
129 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
130 |
* Gets the building stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
131 |
* @param tile the tile of the house to get the building stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
132 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
133 |
* @return the building stage of the house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
134 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
135 |
static inline byte GetHouseBuildingStage(TileIndex t) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
136 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
137 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
138 |
return GB(_m[t].m3, 6, 2); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
139 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
140 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
141 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
142 |
* Sets the building stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
143 |
* @param tile the tile of the house to set the building stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
144 |
* @param stage the new stage |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
145 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
146 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
147 |
static inline void SetHouseBuildingStage(TileIndex t, byte stage) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
148 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
149 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
150 |
SB(_m[t].m3, 6, 2, stage); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
151 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
152 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
153 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
154 |
* Increments the building stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
155 |
* @param tile the tile of the house to increment the building stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
156 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
157 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
158 |
static inline void IncHouseBuildingStage( TileIndex t ) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
159 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
160 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
161 |
AB(_m[t].m3, 6, 2, 1); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
162 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
163 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
164 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
165 |
* Gets the construction stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
166 |
* @param tile the tile of the house to get the construction stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
167 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
168 |
* @return the construction stage of the house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
169 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
170 |
static inline byte GetHouseConstructionTick(TileIndex t) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
171 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
172 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
173 |
return GB(_m[t].m5, 0, 3); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
174 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
175 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
176 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
177 |
* Sets the construction stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
178 |
* @param tile the tile of the house to set the construction stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
179 |
* @param stage the new stage |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
180 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
181 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
182 |
static inline void SetHouseConstructionTick(TileIndex t, byte stage) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
183 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
184 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
185 |
SB(_m[t].m5, 0, 3, stage); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
186 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
187 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
188 |
/** |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
189 |
* Sets the increment stage of a house |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
190 |
* @param tile the tile of the house to increment the construction stage of |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
191 |
* @pre IsTileType(t, MP_HOUSE) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
192 |
*/ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
193 |
static inline void IncHouseConstructionTick(TileIndex t) |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
194 |
{ |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
195 |
assert(IsTileType(t, MP_HOUSE)); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
196 |
AB(_m[t].m5, 0, 3, 1); |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
197 |
} |
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
198 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
199 |
|
507fa7fd189d
(svn r4261) CodeChange : Add and Use Accessor for Houses Construction. And cleaning on town.flags12 too
belugas
parents:
3426
diff
changeset
|
200 |
#endif /* TOWN_MAP_H */ |