Changeset - r26661:0525cb50b40c
[Not reviewed]
master
0 2 0
PeterN - 2 years ago 2022-12-19 20:16:26
peter1138@openttd.org
Fix #10257: Incorrect wire position on sloped bridge heads. (#10258)
2 files changed with 12 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/elrail.cpp
Show inline comments
 
@@ -485,10 +485,11 @@ static void DrawRailCatenaryRailway(cons
 
		/*
 
		 * The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE.
 
		 * Therefore it is safe to use GetSlopePixelZ() for the elevation.
 
		 * Also note that the result of GetSlopePixelZ() is very special for bridge-ramps.
 
		 * Also note that the result of GetSlopePixelZ() is very special for bridge-ramps, so we round the result up or
 
		 * down to the nearest full height change.
 
		 */
 
		AddSortableSpriteToDraw(wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 
			sss->x_size, sss->y_size, sss->z_size, GetSlopePixelZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
 
			sss->x_size, sss->y_size, sss->z_size, (GetSlopePixelZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + 4) / 8 * 8 + sss->z_offset,
 
			IsTransparencySet(TO_CATENARY));
 
	}
 
}
src/table/elrail_data.h
Show inline comments
 
@@ -327,7 +327,9 @@ struct SortableSpriteStruct {
 
/** Distance between wire and rail */
 
static const uint ELRAIL_ELEVATION = 10;
 
/** Wires that a draw one level higher than the north corner. */
 
static const uint ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT;
 
static const uint ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT + 1;
 
/** Wires that a draw one level lower than the north corner. */
 
static const uint ELRAIL_ELEVLOWER = ELRAIL_ELEVATION - 1;
 

	
 
static const SortableSpriteStruct RailCatenarySpriteData[] = {
 
/* X direction
 
@@ -345,9 +347,9 @@ static const SortableSpriteStruct RailCa
 

	
 
	/* "down" tiles
 
		 * Wires */
 
	{ WSO_X_SW_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 6: Wire in X pitch down, pylon on the SW end
 
	{ WSO_X_NE_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 7: Wire in X pitch down, pylon on the NE end
 
	{ WSO_X_SHORT_DOWN,  0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 8: Wire in X pitch down, pylon on both ends
 
	{ WSO_X_SW_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVLOWER }, //! 6: Wire in X pitch down, pylon on the SW end
 
	{ WSO_X_NE_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVLOWER }, //! 7: Wire in X pitch down, pylon on the NE end
 
	{ WSO_X_SHORT_DOWN,  0,  7, 15,  8,  1, ELRAIL_ELEVLOWER }, //! 8: Wire in X pitch down, pylon on both ends
 

	
 

	
 
/* Y direction
 
@@ -365,9 +367,9 @@ static const SortableSpriteStruct RailCa
 

	
 
	/* "down" tiles
 
		 * Wires */
 
	{ WSO_Y_SE_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!15: Wire in Y pitch down, pylon on the SE end
 
	{ WSO_Y_NW_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!16: Wire in Y pitch down, pylon on the NW end
 
	{ WSO_Y_SHORT_DOWN,  7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!17: Wire in Y pitch down, pylon on both ends
 
	{ WSO_Y_SE_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVLOWER }, //!15: Wire in Y pitch down, pylon on the SE end
 
	{ WSO_Y_NW_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVLOWER }, //!16: Wire in Y pitch down, pylon on the NW end
 
	{ WSO_Y_SHORT_DOWN,  7,  0,  8, 15,  1, ELRAIL_ELEVLOWER }, //!17: Wire in Y pitch down, pylon on both ends
 

	
 
/* NS Direction */
 
	{ WSO_NS_SHORT,      8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!18: LEFT  trackbit wire, pylon on both ends
0 comments (0 inline, 0 general)