author | celestar |
Wed, 05 Apr 2006 08:28:03 +0000 | |
changeset 3449 | d45c8d0bf848 |
parent 3369 | cab209754317 |
child 3495 | 6672c181ace4 |
permissions | -rw-r--r-- |
3314
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
2 |
|
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
3 |
#include "industry.h" |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
4 |
#include "macros.h" |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
5 |
#include "tile.h" |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
6 |
|
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
7 |
|
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
8 |
static inline uint GetIndustryIndex(TileIndex t) |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
9 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
10 |
assert(IsTileType(t, MP_INDUSTRY)); |
3314
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
11 |
return _m[t].m2; |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
12 |
} |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
13 |
|
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
14 |
static inline Industry* GetIndustryByTile(TileIndex t) |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
15 |
{ |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
16 |
return GetIndustry(GetIndustryIndex(t)); |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
17 |
} |
3320 | 18 |
|
19 |
||
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
20 |
static inline bool IsIndustryCompleted(TileIndex t) |
3321
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
21 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
22 |
assert(IsTileType(t, MP_INDUSTRY)); |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
23 |
return HASBIT(_m[t].m1, 7); |
3321
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
24 |
} |
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
25 |
|
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
26 |
|
3331 | 27 |
static inline uint GetIndustryGfx(TileIndex t) |
28 |
{ |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
29 |
assert(IsTileType(t, MP_INDUSTRY)); |
3331 | 30 |
return _m[t].m5; |
31 |
} |
|
32 |
||
33 |
static inline void SetIndustryGfx(TileIndex t, uint gfx) |
|
34 |
{ |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
35 |
assert(IsTileType(t, MP_INDUSTRY)); |
3331 | 36 |
_m[t].m5 = gfx; |
37 |
} |
|
38 |
||
39 |
||
3320 | 40 |
static inline void MakeIndustry(TileIndex t, uint index, uint gfx) |
41 |
{ |
|
42 |
SetTileType(t, MP_INDUSTRY); |
|
43 |
_m[t].m1 = 0; |
|
44 |
_m[t].m2 = index; |
|
45 |
_m[t].m3 = 0; |
|
46 |
_m[t].m4 = 0; |
|
47 |
_m[t].m5 = gfx; |
|
48 |
} |