From 04572ed7fe15f5bbda52e76877da225b2dccc92a Mon Sep 17 00:00:00 2001 From: celestar Date: Wed, 22 Mar 2006 11:13:20 +0000 Subject: [PATCH] (svn r4014) -Backport from trunk: Slope and height information returned for some tile types is wrong --- dummy_land.c | 4 ++-- industry_cmd.c | 2 +- station_cmd.c | 2 +- town_cmd.c | 6 ++---- unmovable_cmd.c | 8 ++++++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dummy_land.c b/dummy_land.c index 97b9a05d41..9cc7ec590d 100644 --- a/dummy_land.c +++ b/dummy_land.c @@ -16,12 +16,12 @@ static void DrawTile_Dummy(TileInfo *ti) static uint GetSlopeZ_Dummy(const TileInfo* ti) { - return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; + return 0; } static uint GetSlopeTileh_Dummy(const TileInfo* ti) { - return ti->tileh; + return 0; } static int32 ClearTile_Dummy(TileIndex tile, byte flags) diff --git a/industry_cmd.c b/industry_cmd.c index 4883e2078a..2e9bfb1028 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -398,7 +398,7 @@ static void DrawTile_Industry(TileInfo *ti) static uint GetSlopeZ_Industry(const TileInfo* ti) { - return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; + return ti->z + (ti->tileh == 0 ? 0 : 8); } static uint GetSlopeTileh_Industry(const TileInfo* ti) diff --git a/station_cmd.c b/station_cmd.c index c4cc83576b..1263634191 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -2111,7 +2111,7 @@ void StationPickerDrawSprite(int x, int y, RailType railtype, int image) static uint GetSlopeZ_Station(const TileInfo* ti) { - return (ti->tileh != 0) ? ti->z + 8 : ti->z; + return ti->z + (ti->tileh == 0 ? 0 : 8); } static uint GetSlopeTileh_Station(const TileInfo *ti) diff --git a/town_cmd.c b/town_cmd.c index 77ac02b9aa..aab43ac4bb 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -143,14 +143,12 @@ static void DrawTile_Town(TileInfo *ti) static uint GetSlopeZ_Town(const TileInfo* ti) { - uint z = GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; - if (ti->tileh != 0) z = (z & ~7) + 4; - return (uint16) z; + return ti->z + (ti->tileh == 0 ? 0 : 8); } static uint GetSlopeTileh_Town(const TileInfo *ti) { - return ti->tileh; + return 0; } static void AnimateTile_Town(TileIndex tile) diff --git a/unmovable_cmd.c b/unmovable_cmd.c index 5697f456ca..7eec2924be 100644 --- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -182,12 +182,16 @@ static void DrawTile_Unmovable(TileInfo *ti) static uint GetSlopeZ_Unmovable(const TileInfo* ti) { - return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; + if (_m[ti->tile].m5 == 3) { + return ti->z + GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh); + } else { + return ti->z + (ti->tileh == 0 ? 0 : 8); + } } static uint GetSlopeTileh_Unmovable(const TileInfo *ti) { - return 0; + return _m[ti->tile].m5 == 3 ? ti->tileh : 0; } static int32 ClearTile_Unmovable(TileIndex tile, byte flags)