rail_cmd.c
changeset 3286 3250f1488eb2
parent 3284 fafe2ef7b809
child 3319 7d04847e4689
equal deleted inserted replaced
3285:c162cb0b57c1 3286:3250f1488eb2
  1751 	UpdateSignalsOnSegment(tile, _search_dir_2[track]);
  1751 	UpdateSignalsOnSegment(tile, _search_dir_2[track]);
  1752 }
  1752 }
  1753 
  1753 
  1754 static uint GetSlopeZ_Track(const TileInfo* ti)
  1754 static uint GetSlopeZ_Track(const TileInfo* ti)
  1755 {
  1755 {
       
  1756 	uint tileh = ti->tileh;
  1756 	uint z = ti->z;
  1757 	uint z = ti->z;
  1757 	int th = ti->tileh;
  1758 
  1758 
  1759 	if (tileh == 0) return z;
  1759 	// check if it's a foundation
  1760 	if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
  1760 	if (ti->tileh != 0) {
  1761 		return z + 8;
  1761 		if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
  1762 	} else {
  1762 			return z + 8;
  1763 		uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile));
  1763 		} else {
  1764 
  1764 			uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile));
  1765 		if (f != 0) {
  1765 
  1766 			if (f < 15) return z + 8; // leveled foundation
  1766 			if (f != 0) {
  1767 			tileh = _inclined_tileh[f - 15]; // inclined foundation
  1767 				if (f < 15) {
  1768 		}
  1768 					// leveled foundation
  1769 		return z + GetPartialZ(ti->x & 0xF, ti->y & 0xF, tileh);
  1769 					return z + 8;
  1770 	}
  1770 				}
       
  1771 				// inclined foundation
       
  1772 				th = _inclined_tileh[f - 15];
       
  1773 			}
       
  1774 		}
       
  1775 		return GetPartialZ(ti->x & 0xF, ti->y & 0xF, th) + z;
       
  1776 	}
       
  1777 	return z;
       
  1778 }
  1771 }
  1779 
  1772 
  1780 static uint GetSlopeTileh_Track(const TileInfo *ti)
  1773 static uint GetSlopeTileh_Track(const TileInfo *ti)
  1781 {
  1774 {
  1782 	// check if it's a foundation
  1775 	if (ti->tileh == 0) return ti->tileh;
  1783 	if (ti->tileh != 0) {
  1776 	if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
  1784 		if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
  1777 		return 0;
  1785 			return 0;
  1778 	} else {
  1786 		} else {
  1779 		uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile));
  1787 			uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile));
  1780 
  1788 			if (f != 0) {
  1781 		if (f == 0) return ti->tileh;
  1789 				if (f < 15) {
  1782 		if (f < 15) return 0; // leveled foundation
  1790 					// leveled foundation
  1783 		return _inclined_tileh[f - 15]; // inclined foundation
  1791 					return 0;
  1784 	}
  1792 				}
       
  1793 				// inclined foundation
       
  1794 				return _inclined_tileh[f - 15];
       
  1795 			}
       
  1796 		}
       
  1797 	}
       
  1798 	return ti->tileh;
       
  1799 }
  1785 }
  1800 
  1786 
  1801 static void GetAcceptedCargo_Track(TileIndex tile, AcceptedCargo ac)
  1787 static void GetAcceptedCargo_Track(TileIndex tile, AcceptedCargo ac)
  1802 {
  1788 {
  1803 	/* not used */
  1789 	/* not used */