summaryrefslogtreecommitdiff
path: root/landscape.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-02 12:49:18 +0000
committertron <tron@openttd.org>2006-04-02 12:49:18 +0000
commit892a4c587dfd1427fcebf3081520524a2c822ae6 (patch)
tree6165bdad32d288513a9323a661873fa96839184c /landscape.c
parente9a5ca70e2b04f6df8f719e8649b4a629ba49475 (diff)
downloadopenttd-892a4c587dfd1427fcebf3081520524a2c822ae6.tar.xz
(svn r4242) Pass TileIndex and slope to GetSlopeTileh_*() instead of TileInfo
Diffstat (limited to 'landscape.c')
-rw-r--r--landscape.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/landscape.c b/landscape.c
index 033ef3205..ad684160a 100644
--- a/landscape.c
+++ b/landscape.c
@@ -183,11 +183,11 @@ uint GetSlopeZ(int x, int y)
// direction=true: check for foundation in east and south corner
// direction=false: check for foundation in west and south corner
-static bool hasFoundation(const TileInfo* ti, bool direction)
+static bool HasFoundation(TileIndex tile, bool direction)
{
bool south, other; // southern corner and east/west corner
- uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti);
- uint tileh = ti->tileh;
+ uint tileh = GetTileSlope(tile, NULL);
+ uint slope = _tile_type_procs[GetTileType(tile)]->get_slope_tileh_proc(tile, tileh);
if (slope == 0 && slope != tileh) tileh = 15;
south = (tileh & 2) != (slope & 2);
@@ -204,11 +204,8 @@ void DrawFoundation(TileInfo *ti, uint f)
{
uint32 sprite_base = SPR_SLOPES_BASE-14;
- TileInfo ti2;
- FindLandscapeHeight(&ti2, ti->x, ti->y - 1);
- if (hasFoundation(&ti2, true)) sprite_base += 22; // foundation in NW direction
- FindLandscapeHeight(&ti2, ti->x - 1, ti->y);
- if (hasFoundation(&ti2, false)) sprite_base += 22 * 2; // foundation in NE direction
+ if (HasFoundation(TILE_ADDXY(ti->tile, 0, -1), true)) sprite_base += 22; // foundation in NW direction
+ if (HasFoundation(TILE_ADDXY(ti->tile, -1, 0), false)) sprite_base += 44; // foundation in NE direction
if (f < 15) {
// leveled foundation