| author | Darkvater |
| Fri, 31 Mar 2006 21:22:41 +0000 | |
| changeset 3408 | 313f35564673 |
| parent 3369 | 00c2ca209a89 |
| child 3495 | f7d3ae07f4aa |
| permissions | -rw-r--r-- |
|
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
2 |
|
|
b8b234d4584f
(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" |
|
b8b234d4584f
(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" |
|
b8b234d4584f
(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" |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
6 |
|
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
7 |
|
|
b8b234d4584f
(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) |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
9 |
{
|
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
10 |
assert(IsTileType(t, MP_INDUSTRY)); |
|
3314
b8b234d4584f
(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; |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
12 |
} |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
13 |
|
|
b8b234d4584f
(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) |
|
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
15 |
{
|
|
b8b234d4584f
(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)); |
|
b8b234d4584f
(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
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
20 |
static inline bool IsIndustryCompleted(TileIndex t) |
|
3321
c5f2375046bc
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
21 |
{
|
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
22 |
assert(IsTileType(t, MP_INDUSTRY)); |
|
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
23 |
return HASBIT(_m[t].m1, 7); |
|
3321
c5f2375046bc
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
24 |
} |
|
c5f2375046bc
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
25 |
|
|
c5f2375046bc
(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
00c2ca209a89
(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
00c2ca209a89
(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 |
} |