Files
@ r4962:2ff3f433591e
Branch filter:
Location: cpp/openttd-patchpack/source/industry_map.h - annotation
r4962:2ff3f433591e
6.5 KiB
text/x-c
(svn r6961) -Codechange: Remove relic from r212 WWT_NODISTXTBTN which was originally used to not
to allow clicking if a button was disabled. This has been superseded in r212 with
general code that doesn't allow any click events for disabled buttons.
to allow clicking if a button was disabled. This has been superseded in r212 with
general code that doesn't allow any click events for disabled buttons.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | r3314:95a9020945e1 r3314:95a9020945e1 r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3545:523dd56b3018 r3553:d56121775215 r3553:d56121775215 r3553:d56121775215 r3553:d56121775215 r3553:d56121775215 r3553:d56121775215 r3545:523dd56b3018 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r4583:d52d274610b9 r3545:523dd56b3018 r3314:95a9020945e1 r4330:1186b19da099 r3314:95a9020945e1 r3369:c4df9e1f62cd r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3314:95a9020945e1 r3320:36531bfb5ef3 r3369:c4df9e1f62cd r3321:0e4e0764ce52 r3369:c4df9e1f62cd r3369:c4df9e1f62cd r3321:0e4e0764ce52 r3321:0e4e0764ce52 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3321:0e4e0764ce52 r3499:c30aa286c5b5 r3331:8fbe2189b312 r3369:c4df9e1f62cd r3331:8fbe2189b312 r3331:8fbe2189b312 r3331:8fbe2189b312 r3499:c30aa286c5b5 r3331:8fbe2189b312 r3369:c4df9e1f62cd r3331:8fbe2189b312 r3331:8fbe2189b312 r3331:8fbe2189b312 r4330:1186b19da099 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3320:36531bfb5ef3 r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3495:3c692ea3e92d r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r4077:259c4c4aacad r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3499:c30aa286c5b5 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3538:f597eb35d3c7 r3495:3c692ea3e92d | /* $Id$ */
/** @file industry_map.h Accessors for industries */
#ifndef INDUSTRY_MAP_H
#define INDUSTRY_MAP_H
#include "industry.h"
#include "macros.h"
#include "tile.h"
/**
* The following enums are indices used to know what to draw for this industry tile.
* They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
* How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3)
*/
enum {
GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0,
GFX_COAL_MINE_TOWER_ANIMATED = 1,
GFX_POWERPLANT_CHIMNEY = 8,
GFX_POWERPLANT_SPARKS = 10,
GFX_OILRIG_1 = 24,
GFX_OILRIG_2 = 25,
GFX_OILRIG_3 = 26,
GFX_OILRIG_4 = 27,
GFX_OILRIG_5 = 28,
GFX_OILWELL_NOT_ANIMATED = 29,
GFX_OILWELL_ANIMATED_1 = 30,
GFX_OILWELL_ANIMATED_2 = 31,
GFX_OILWELL_ANIMATED_3 = 32,
GFX_COPPER_MINE_TOWER_NOT_ANIMATED = 47,
GFX_COPPER_MINE_TOWER_ANIMATED = 48,
GFX_COPPER_MINE_CHIMNEY = 49,
GFX_GOLD_MINE_TOWER_NOT_ANIMATED = 79,
GFX_GOLD_MINE_TOWER_ANIMATED = 88,
GFX_TOY_FACTORY = 143,
GFX_PLASTIC_FOUNTAIN_ANIMATED_1 = 148,
GFX_PLASTIC_FOUNTAIN_ANIMATED_2 = 149,
GFX_PLASTIC_FOUNTAIN_ANIMATED_3 = 150,
GFX_PLASTIC_FOUNTAIN_ANIMATED_4 = 151,
GFX_PLASTIC_FOUNTAIN_ANIMATED_5 = 152,
GFX_PLASTIC_FOUNTAIN_ANIMATED_6 = 153,
GFX_PLASTIC_FOUNTAIN_ANIMATED_7 = 154,
GFX_PLASTIC_FOUNTAIN_ANIMATED_8 = 155,
GFX_BUBBLE_GENERATOR = 161,
GFX_BUBBLE_CATCHER = 162,
GFX_TOFFEE_QUARY = 165,
GFX_SUGAR_MINE_SIEVE = 174,
};
static inline IndustryID GetIndustryIndex(TileIndex t)
{
assert(IsTileType(t, MP_INDUSTRY));
return _m[t].m2;
}
static inline Industry* GetIndustryByTile(TileIndex t)
{
return GetIndustry(GetIndustryIndex(t));
}
static inline bool IsIndustryCompleted(TileIndex t)
{
assert(IsTileType(t, MP_INDUSTRY));
return HASBIT(_m[t].m1, 7);
}
IndustryType GetIndustryType(TileIndex tile);
/**
* Set if the industry that owns the tile as under construction or not
* @param tile the tile to query
* @param isCompleted whether it is completed or not
* @pre IsTileType(tile, MP_INDUSTRY)
*/
static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted)
{
assert(IsTileType(tile, MP_INDUSTRY));
SB(_m[tile].m1, 7, 1, isCompleted ? 1 :0);
}
/**
* Returns the industry construction stage of the specified tile
* @param tile the tile to query
* @pre IsTileType(tile, MP_INDUSTRY)
* @return the construction stage
*/
static inline byte GetIndustryConstructionStage(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
return GB(_m[tile].m1, 0, 2);
}
/**
* Sets the industry construction stage of the specified tile
* @param tile the tile to query
* @param value the new construction stage
* @pre IsTileType(tile, MP_INDUSTRY)
*/
static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
{
assert(IsTileType(tile, MP_INDUSTRY));
SB(_m[tile].m1, 0, 2, value);
}
static inline IndustryGfx GetIndustryGfx(TileIndex t)
{
assert(IsTileType(t, MP_INDUSTRY));
return _m[t].m5;
}
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
{
assert(IsTileType(t, MP_INDUSTRY));
_m[t].m5 = gfx;
}
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx)
{
SetTileType(t, MP_INDUSTRY);
_m[t].m1 = 0;
_m[t].m2 = index;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = gfx;
}
/**
* Returns this indutry tile's construction counter value
* @param tile the tile to query
* @pre IsTileType(tile, MP_INDUSTRY)
* @return the construction counter
*/
static inline byte GetIndustryConstructionCounter(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
return GB(_m[tile].m1, 2, 2);
}
/**
* Sets this indutry tile's construction counter value
* @param tile the tile to query
* @param value the new value for the construction counter
* @pre IsTileType(tile, MP_INDUSTRY)
*/
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
{
assert(IsTileType(tile, MP_INDUSTRY));
SB(_m[tile].m1, 2, 2, value);
}
/**
* Reset the construction stage counter of the industry,
* as well as the completion bit.
* In fact, it is the same as restarting construction frmo ground up
* @param tile the tile to query
* @param generating_world whether generating a world or not
* @pre IsTileType(tile, MP_INDUSTRY)
*/
static inline void ResetIndustryConstructionStage(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
_m[tile].m1 = 0;
}
typedef struct IndustryTypeSolver {
IndustryGfx MinGfx;
IndustryGfx MaxGfx;
} IndustryTypeSolver;
static const IndustryTypeSolver industry_gfx_Solver [IT_END] = {
{ 0, 6}, //IT_COAL_MINE
{ 7, 10}, //IT_POWER_STATION,
{ 11, 15}, //IT_SAWMILL,
{ 16, 17}, //IT_FOREST,
{ 18, 23}, //IT_OIL_REFINERY,
{ 24, 28}, //IT_OIL_RIG,
{ 29, 31}, //IT_OIL_WELL,
{ 32, 38}, //IT_FARM,
{ 39, 42}, //IT_FACTORY,
{ 43, 46}, //IT_PRINTING_WORKS,
{ 47, 51}, //IT_COPPER_MINE,
{ 52, 57}, //IT_STEEL_MILL,
{ 58, 59}, //IT_BANK_TEMP,
{ 60, 63}, //IT_FOOD_PROCESS,
{ 64, 71}, //IT_PAPER_MILL,
{ 72, 88}, //IT_GOLD_MINE,
{ 89, 90}, //IT_BANK_TROPIC_ARCTIC,
{ 91, 99}, //IT_DIAMOND_MINE,
{100, 115}, //IT_IRON_MINE,
{116, 116}, //IT_FRUIT_PLANTATION,
{117, 117}, //IT_RUBBER_PLANTATION,
{118, 119}, //IT_WATER_SUPPLY,
{120, 120}, //IT_WATER_TOWER,
{121, 124}, //IT_FACTORY_2,
{125, 128}, //IT_LUMBER_MILL,
{129, 130}, //IT_COTTON_CANDY,
{131, 134}, //IT_CANDY_FACTORY or sweet factory
{135, 136}, //IT_BATTERY_FARM,
{137, 137}, //IT_COLA_WELLS,
{138, 141}, //IT_TOY_SHOP,
{142, 147}, //IT_TOY_FACTORY,
{148, 155}, //IT_PLASTIC_FOUNTAINS,
{156, 159}, //IT_FIZZY_DRINK_FACTORY,
{160, 163}, //IT_BUBBLE_GENERATOR,
{164, 166}, //IT_TOFFEE_QUARRY,
{167, 174} //IT_SUGAR_MINE,
};
/**
* Get the animation loop number
* @param tile the tile to get the animation loop number of
* @pre IsTileType(tile, MP_INDUSTRY
*/
static inline byte GetIndustryAnimationLoop(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
return _m[tile].m4;
}
/**
* Set the animation loop number
* @param tile the tile to set the animation loop number of
* @param count the new animation frame number
* @pre IsTileType(tile, MP_INDUSTRY
*/
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
{
assert(IsTileType(tile, MP_INDUSTRY));
_m[tile].m4 = count;
}
#endif /* INDUSTRY_MAP_H */
|