(svn r3996) -Fix: Slope and height information returned for some tile types is wrong
authortron
Tue, 21 Mar 2006 20:02:05 +0000
changeset 3282 4f91ee240e68
parent 3281 0f3d836e35b1
child 3283 651846bbcc78
(svn r3996) -Fix: Slope and height information returned for some tile types is wrong
This leads to graphical glitches when drawing foundations.
This doesn't fix all problems, but at least some of them.
dummy_land.c
industry_cmd.c
station_cmd.c
town_cmd.c
unmovable_cmd.c
--- a/dummy_land.c	Tue Mar 21 09:44:07 2006 +0000
+++ b/dummy_land.c	Tue Mar 21 20:02:05 2006 +0000
@@ -16,12 +16,12 @@
 
 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)
--- a/industry_cmd.c	Tue Mar 21 09:44:07 2006 +0000
+++ b/industry_cmd.c	Tue Mar 21 20:02:05 2006 +0000
@@ -399,7 +399,7 @@
 
 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)
--- a/station_cmd.c	Tue Mar 21 09:44:07 2006 +0000
+++ b/station_cmd.c	Tue Mar 21 20:02:05 2006 +0000
@@ -2032,7 +2032,7 @@
 
 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)
--- a/town_cmd.c	Tue Mar 21 09:44:07 2006 +0000
+++ b/town_cmd.c	Tue Mar 21 20:02:05 2006 +0000
@@ -144,14 +144,12 @@
 
 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)
--- a/unmovable_cmd.c	Tue Mar 21 09:44:07 2006 +0000
+++ b/unmovable_cmd.c	Tue Mar 21 20:02:05 2006 +0000
@@ -184,12 +184,16 @@
 
 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)