summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/industry.h15
-rw-r--r--src/industry_cmd.cpp6
-rw-r--r--src/industry_map.h1
3 files changed, 16 insertions, 6 deletions
diff --git a/src/industry.h b/src/industry.h
index 2cdf1ce7e..c19dd83ae 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -222,9 +222,18 @@ extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
{
- assert(gfx < INVALID_INDUSTRYTILE);
- const IndustryTileSpec *it = &_industry_tile_specs[gfx];
- return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
+ /* the 0xFF should be GFX_WATERTILE_SPECIALCHECK but for reasons of include mess,
+ * we'll simplify the writing.
+ * Basically, the first test is required since the GFX_WATERTILE_SPECIALCHECK value
+ * will never be assigned as a tile index and is only required in order to do some
+ * tests while building the industry (as in WATER REQUIRED */
+ if (gfx != 0xFF) {
+ assert(gfx < INVALID_INDUSTRYTILE);
+ const IndustryTileSpec *it = &_industry_tile_specs[gfx];
+ return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
+ } else {
+ return gfx;
+ }
}
/* smallmap_gui.cpp */
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 1d5b2939d..ea9d8401d 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1183,11 +1183,11 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
if (!IsValidTile(cur_tile)) {
- if (gfx == 0xff) continue;
+ if (gfx == GFX_WATERTILE_SPECIALCHECK) continue;
return false;
}
- if (gfx == 0xFF) {
+ if (gfx == GFX_WATERTILE_SPECIALCHECK) {
if (!IsTileType(cur_tile, MP_WATER) ||
GetTileSlope(cur_tile, NULL) != SLOPE_FLAT) {
return false;
@@ -1452,7 +1452,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
do {
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
- if (it->gfx != 0xFF) {
+ if (it->gfx != GFX_WATERTILE_SPECIALCHECK) {
byte size;
size = it->ti.x;
diff --git a/src/industry_map.h b/src/industry_map.h
index 18e72eb33..888f8f7a6 100644
--- a/src/industry_map.h
+++ b/src/industry_map.h
@@ -48,6 +48,7 @@ enum {
GFX_BUBBLE_CATCHER = 162,
GFX_TOFFEE_QUARY = 165,
GFX_SUGAR_MINE_SIEVE = 174,
+ GFX_WATERTILE_SPECIALCHECK = 255, ///< not really a tile, but rather a very special check
};
/**