author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5475 | 2e6990a8c7c4 |
child 6201 | bee01dc45e39 |
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 |
|
3495
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
3 |
/** @file industry_map.h Accessors for industries */ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
4 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
5 |
#ifndef INDUSTRY_MAP_H |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
6 |
#define INDUSTRY_MAP_H |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
7 |
|
3314
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
8 |
#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
|
9 |
#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
|
10 |
#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
|
11 |
|
3545
b08ce1bbb589
(svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents:
3538
diff
changeset
|
12 |
|
3553
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
13 |
|
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
14 |
/** |
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
15 |
* The following enums are indices used to know what to draw for this industry tile. |
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
16 |
* They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h |
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
17 |
* How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3) |
4aab99ade276
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents:
3545
diff
changeset
|
18 |
*/ |
3545
b08ce1bbb589
(svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents:
3538
diff
changeset
|
19 |
enum { |
4583
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
20 |
GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
21 |
GFX_COAL_MINE_TOWER_ANIMATED = 1, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
22 |
GFX_POWERPLANT_CHIMNEY = 8, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
23 |
GFX_POWERPLANT_SPARKS = 10, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
24 |
GFX_OILRIG_1 = 24, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
25 |
GFX_OILRIG_2 = 25, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
26 |
GFX_OILRIG_3 = 26, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
27 |
GFX_OILRIG_4 = 27, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
28 |
GFX_OILRIG_5 = 28, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
29 |
GFX_OILWELL_NOT_ANIMATED = 29, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
30 |
GFX_OILWELL_ANIMATED_1 = 30, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
31 |
GFX_OILWELL_ANIMATED_2 = 31, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
32 |
GFX_OILWELL_ANIMATED_3 = 32, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
33 |
GFX_COPPER_MINE_TOWER_NOT_ANIMATED = 47, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
34 |
GFX_COPPER_MINE_TOWER_ANIMATED = 48, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
35 |
GFX_COPPER_MINE_CHIMNEY = 49, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
36 |
GFX_GOLD_MINE_TOWER_NOT_ANIMATED = 79, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
37 |
GFX_GOLD_MINE_TOWER_ANIMATED = 88, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
38 |
GFX_TOY_FACTORY = 143, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
39 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_1 = 148, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
40 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_2 = 149, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
41 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_3 = 150, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
42 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_4 = 151, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
43 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_5 = 152, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
44 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_6 = 153, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
45 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_7 = 154, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
46 |
GFX_PLASTIC_FOUNTAIN_ANIMATED_8 = 155, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
47 |
GFX_BUBBLE_GENERATOR = 161, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
48 |
GFX_BUBBLE_CATCHER = 162, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
49 |
GFX_TOFFEE_QUARY = 165, |
af31ba5db77d
(svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents:
4330
diff
changeset
|
50 |
GFX_SUGAR_MINE_SIEVE = 174, |
5434
4739ee9714f5
(svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
rubidium
parents:
4583
diff
changeset
|
51 |
NUM_INDUSTRY_GFXES = 175, |
3545
b08ce1bbb589
(svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents:
3538
diff
changeset
|
52 |
}; |
3314
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
53 |
|
4330
cf31daa8b321
(svn r6005) -Cleanup: introduce IndustryID and use it
rubidium
parents:
4077
diff
changeset
|
54 |
static inline IndustryID GetIndustryIndex(TileIndex t) |
3314
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
55 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
} |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
59 |
|
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
60 |
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
|
61 |
{ |
6aaeba4b92e8
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff
changeset
|
62 |
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
|
63 |
} |
3320 | 64 |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
65 |
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
|
66 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
67 |
assert(IsTileType(t, MP_INDUSTRY)); |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
68 |
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
|
69 |
} |
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
70 |
|
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
71 |
IndustryType GetIndustryType(TileIndex tile); |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
72 |
|
3495
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
73 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
74 |
* Set if the industry that owns the tile as under construction or not |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
75 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
76 |
* @param isCompleted whether it is completed or not |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
77 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
78 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
79 |
static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
80 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
81 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
82 |
SB(_m[tile].m1, 7, 1, isCompleted ? 1 :0); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
83 |
} |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
84 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
85 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
86 |
* Returns the industry construction stage of the specified tile |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
87 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
88 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
89 |
* @return the construction stage |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
90 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
91 |
static inline byte GetIndustryConstructionStage(TileIndex tile) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
92 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
93 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
94 |
return GB(_m[tile].m1, 0, 2); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
95 |
} |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
96 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
97 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
98 |
* Sets the industry construction stage of the specified tile |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
99 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
100 |
* @param value the new construction stage |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
101 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
102 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
103 |
static inline void SetIndustryConstructionStage(TileIndex tile, byte value) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
104 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
105 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
106 |
SB(_m[tile].m1, 0, 2, value); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
107 |
} |
3321
4061bfef1830
(svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents:
3320
diff
changeset
|
108 |
|
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
109 |
static inline IndustryGfx GetIndustryGfx(TileIndex t) |
3331 | 110 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
111 |
assert(IsTileType(t, MP_INDUSTRY)); |
3331 | 112 |
return _m[t].m5; |
113 |
} |
|
114 |
||
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
115 |
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx) |
3331 | 116 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3331
diff
changeset
|
117 |
assert(IsTileType(t, MP_INDUSTRY)); |
3331 | 118 |
_m[t].m5 = gfx; |
119 |
} |
|
120 |
||
4330
cf31daa8b321
(svn r6005) -Cleanup: introduce IndustryID and use it
rubidium
parents:
4077
diff
changeset
|
121 |
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx) |
3320 | 122 |
{ |
123 |
SetTileType(t, MP_INDUSTRY); |
|
124 |
_m[t].m1 = 0; |
|
125 |
_m[t].m2 = index; |
|
126 |
_m[t].m3 = 0; |
|
127 |
_m[t].m4 = 0; |
|
128 |
_m[t].m5 = gfx; |
|
129 |
} |
|
3495
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
130 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
131 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
132 |
* Returns this indutry tile's construction counter value |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
133 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
134 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
135 |
* @return the construction counter |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
136 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
137 |
static inline byte GetIndustryConstructionCounter(TileIndex tile) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
138 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
139 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
140 |
return GB(_m[tile].m1, 2, 2); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
141 |
} |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
142 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
143 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
144 |
* Sets this indutry tile's construction counter value |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
145 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
146 |
* @param value the new value for the construction counter |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
147 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
148 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
149 |
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
150 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
151 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
152 |
SB(_m[tile].m1, 2, 2, value); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
153 |
} |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
154 |
|
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
155 |
/** |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
156 |
* Reset the construction stage counter of the industry, |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
157 |
* as well as the completion bit. |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
158 |
* In fact, it is the same as restarting construction frmo ground up |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
159 |
* @param tile the tile to query |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
160 |
* @param generating_world whether generating a world or not |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
161 |
* @pre IsTileType(tile, MP_INDUSTRY) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
162 |
*/ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
163 |
static inline void ResetIndustryConstructionStage(TileIndex tile) |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
164 |
{ |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
165 |
assert(IsTileType(tile, MP_INDUSTRY)); |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
166 |
_m[tile].m1 = 0; |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
167 |
} |
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
168 |
|
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
169 |
typedef struct IndustryTypeSolver { |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
170 |
IndustryGfx MinGfx; |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
171 |
IndustryGfx MaxGfx; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3689
diff
changeset
|
172 |
} IndustryTypeSolver; |
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
173 |
|
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
174 |
static const IndustryTypeSolver industry_gfx_Solver [IT_END] = { |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
175 |
{ 0, 6}, //IT_COAL_MINE |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
176 |
{ 7, 10}, //IT_POWER_STATION, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
177 |
{ 11, 15}, //IT_SAWMILL, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
178 |
{ 16, 17}, //IT_FOREST, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
179 |
{ 18, 23}, //IT_OIL_REFINERY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
180 |
{ 24, 28}, //IT_OIL_RIG, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
181 |
{ 29, 31}, //IT_OIL_WELL, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
182 |
{ 32, 38}, //IT_FARM, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
183 |
{ 39, 42}, //IT_FACTORY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
184 |
{ 43, 46}, //IT_PRINTING_WORKS, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
185 |
{ 47, 51}, //IT_COPPER_MINE, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
186 |
{ 52, 57}, //IT_STEEL_MILL, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
187 |
{ 58, 59}, //IT_BANK_TEMP, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
188 |
{ 60, 63}, //IT_FOOD_PROCESS, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
189 |
{ 64, 71}, //IT_PAPER_MILL, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
190 |
{ 72, 88}, //IT_GOLD_MINE, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
191 |
{ 89, 90}, //IT_BANK_TROPIC_ARCTIC, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
192 |
{ 91, 99}, //IT_DIAMOND_MINE, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
193 |
{100, 115}, //IT_IRON_MINE, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
194 |
{116, 116}, //IT_FRUIT_PLANTATION, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
195 |
{117, 117}, //IT_RUBBER_PLANTATION, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
196 |
{118, 119}, //IT_WATER_SUPPLY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
197 |
{120, 120}, //IT_WATER_TOWER, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
198 |
{121, 124}, //IT_FACTORY_2, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
199 |
{125, 128}, //IT_LUMBER_MILL, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
200 |
{129, 130}, //IT_COTTON_CANDY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
201 |
{131, 134}, //IT_CANDY_FACTORY or sweet factory |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
202 |
{135, 136}, //IT_BATTERY_FARM, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
203 |
{137, 137}, //IT_COLA_WELLS, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
204 |
{138, 141}, //IT_TOY_SHOP, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
205 |
{142, 147}, //IT_TOY_FACTORY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
206 |
{148, 155}, //IT_PLASTIC_FOUNTAINS, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
207 |
{156, 159}, //IT_FIZZY_DRINK_FACTORY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
208 |
{160, 163}, //IT_BUBBLE_GENERATOR, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
209 |
{164, 166}, //IT_TOFFEE_QUARRY, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
210 |
{167, 174} //IT_SUGAR_MINE, |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
211 |
}; |
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3495
diff
changeset
|
212 |
|
3538
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
213 |
/** |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
214 |
* Get the animation loop number |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
215 |
* @param tile the tile to get the animation loop number of |
5434
4739ee9714f5
(svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
rubidium
parents:
4583
diff
changeset
|
216 |
* @pre IsTileType(tile, MP_INDUSTRY) |
3538
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
217 |
*/ |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
218 |
static inline byte GetIndustryAnimationLoop(TileIndex tile) |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
219 |
{ |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
220 |
assert(IsTileType(tile, MP_INDUSTRY)); |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
221 |
return _m[tile].m4; |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
222 |
} |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
223 |
|
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
224 |
/** |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
225 |
* Set the animation loop number |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
226 |
* @param tile the tile to set the animation loop number of |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
227 |
* @param count the new animation frame number |
5434
4739ee9714f5
(svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
rubidium
parents:
4583
diff
changeset
|
228 |
* @pre IsTileType(tile, MP_INDUSTRY) |
3538
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
229 |
*/ |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
230 |
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count) |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
231 |
{ |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
232 |
assert(IsTileType(tile, MP_INDUSTRY)); |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
233 |
_m[tile].m4 = count; |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
234 |
} |
750c4ea83357
(svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents:
3499
diff
changeset
|
235 |
|
5435
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
236 |
/** |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
237 |
* Get the animation state |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
238 |
* @param tile the tile to get the animation state of |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
239 |
* @pre IsTileType(tile, MP_INDUSTRY) |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
240 |
*/ |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
241 |
static inline byte GetIndustryAnimationState(TileIndex tile) |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
242 |
{ |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
243 |
assert(IsTileType(tile, MP_INDUSTRY)); |
5436
b3d017be25b4
(svn r7642) -Codechange: unify all the different locations where the animation state is stored into a single location.
rubidium
parents:
5435
diff
changeset
|
244 |
return _m[tile].m3; |
5435
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
245 |
} |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
246 |
|
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
247 |
/** |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
248 |
* Set the animation state |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
249 |
* @param tile the tile to set the animation state of |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
250 |
* @param count the new animation state |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
251 |
* @pre IsTileType(tile, MP_INDUSTRY) |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
252 |
*/ |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
253 |
static inline void SetIndustryAnimationState(TileIndex tile, byte state) |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
254 |
{ |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
255 |
assert(IsTileType(tile, MP_INDUSTRY)); |
5436
b3d017be25b4
(svn r7642) -Codechange: unify all the different locations where the animation state is stored into a single location.
rubidium
parents:
5435
diff
changeset
|
256 |
_m[tile].m3 = state; |
5435
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
257 |
} |
ffb0c3620c6e
(svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents:
5434
diff
changeset
|
258 |
|
3495
6672c181ace4
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3369
diff
changeset
|
259 |
#endif /* INDUSTRY_MAP_H */ |