summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-26 16:51:10 +0000
committerrubidium <rubidium@openttd.org>2007-07-26 16:51:10 +0000
commitd624f66c794109a22787685a3aa53d6cf35a02ba (patch)
tree4b6a986aa841f12efff161e45aacd1a023cff71d /src/industry_cmd.cpp
parent5bd241eb5b151dd9a5ebda0a93aff8740713ce62 (diff)
downloadopenttd-d624f66c794109a22787685a3aa53d6cf35a02ba.tar.xz
(svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index fdbda407f..bbdab2415 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -255,7 +255,6 @@ static void DrawTile_Industry(TileInfo *ti)
Industry *ind = GetIndustryByTile(ti->tile);
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
const DrawBuildingsTileStruct *dits;
- byte z;
SpriteID image;
SpriteID pal;
@@ -287,12 +286,8 @@ static void DrawTile_Industry(TileInfo *ti)
pal = dits->ground.pal;
}
- z = ti->z;
- /* Add bricks below the industry? */
- if (ti->tileh != SLOPE_FLAT) {
- DrawFoundation(ti, ti->tileh);
- z += TILE_HEIGHT;
- }
+ /* DrawFoundation() modifes ti->z and ti->tileh */
+ if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
DrawGroundSprite(image, pal);
@@ -306,7 +301,7 @@ static void DrawTile_Industry(TileInfo *ti)
dits->width + 1,
dits->height + 1,
dits->dz,
- z,
+ ti->z,
HASBIT(_transparent_opt, TO_INDUSTRIES));
if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return;
@@ -323,9 +318,9 @@ static uint GetSlopeZ_Industry(TileIndex tile, uint x, uint y)
return GetTileMaxZ(tile);
}
-static Slope GetSlopeTileh_Industry(TileIndex tile, Slope tileh)
+static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
{
- return SLOPE_FLAT;
+ return FlatteningFoundation(tileh);
}
static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
@@ -1995,7 +1990,7 @@ extern const TileTypeProcs _tile_type_industry_procs = {
ChangeTileOwner_Industry, /* change_tile_owner_proc */
GetProducedCargo_Industry, /* get_produced_cargo_proc */
NULL, /* vehicle_enter_tile_proc */
- GetSlopeTileh_Industry, /* get_slope_tileh_proc */
+ GetFoundation_Industry, /* get_foundation_proc */
};
static const SaveLoad _industry_desc[] = {