road_cmd.c
changeset 39 d177340ed556
parent 22 fe6f35cc987b
child 72 24bdf837198c
--- a/road_cmd.c	Fri Aug 13 17:41:44 2004 +0000
+++ b/road_cmd.c	Fri Aug 13 18:27:33 2004 +0000
@@ -875,7 +875,29 @@
 		}
 		return GetPartialZ(ti->x&0xF, ti->y&0xF, th) + z;
 	}
-	return z;
+	return z; // normal Z if no slope
+}
+
+uint GetSlopeTileh_Road(TileInfo *ti)
+{
+	// check if it's a foundation
+	if (ti->tileh != 0) {
+		if ((ti->map5 & 0xE0) == 0) { /* road or crossing */
+			uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F);
+			if (f != 0) {
+				if (f < 15) {
+					// leveled foundation
+					return 0;
+				}
+				// inclined foundation
+				return _inclined_tileh[f - 15];
+			}
+		} else if ((ti->map5 & 0xF0) == 0x20) {
+			// depot
+			return 0;
+		}
+	}
+	return ti->tileh;
 }
 
 static void GetAcceptedCargo_Road(uint tile, AcceptedCargo *ac)
@@ -1129,4 +1151,5 @@
 	NULL,											/* get_produced_cargo_proc */
 	VehicleEnter_Road,				/* vehicle_enter_tile_proc */
 	VehicleLeave_Road,				/* vehicle_leave_tile_proc */
+	GetSlopeTileh_Road,				/* get_slope_tileh_proc */
 };