mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r5259) -Codechange: GetBridgeHeight{Ramp,}() now returns the height of the bridge, not one level lower
This commit is contained in:
parent
b6e2b38fe7
commit
f5638395fe
12
elrail.c
12
elrail.c
@ -284,7 +284,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||||||
IsBridgeTile(ti->tile) &&
|
IsBridgeTile(ti->tile) &&
|
||||||
IsBridgeMiddle(ti->tile) &&
|
IsBridgeMiddle(ti->tile) &&
|
||||||
!(_display_opt & DO_TRANS_BUILDINGS) &&
|
!(_display_opt & DO_TRANS_BUILDINGS) &&
|
||||||
GetBridgeHeight(ti->tile) <= TilePixelHeight(ti->tile)
|
GetBridgeHeight(ti->tile) <= TilePixelHeight(ti->tile) + TILE_HEIGHT
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
assert(PCPconfig != 0); /* We have a pylon on neither end of the wire, that doesn't work (since we have no sprites for that) */
|
assert(PCPconfig != 0); /* We have a pylon on neither end of the wire, that doesn't work (since we have no sprites for that) */
|
||||||
@ -321,24 +321,24 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||||
sss->x_size, sss->y_size, sss->z_size, GetBridgeHeight(ti->tile) + sss->z_offset + 8);
|
sss->x_size, sss->y_size, sss->z_size, GetBridgeHeight(ti->tile) + sss->z_offset);
|
||||||
|
|
||||||
/* Finished with wires, draw pylons */
|
/* Finished with wires, draw pylons */
|
||||||
/* every other tile needs a pylon on the northern end */
|
/* every other tile needs a pylon on the northern end */
|
||||||
if (num % 2) {
|
if (num % 2) {
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
AddSortableSpriteToDraw( pylons_bridge[0 + HASBIT(tlg, 0)], ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, GetBridgeHeight(ti->tile) + TILE_HEIGHT);
|
AddSortableSpriteToDraw( pylons_bridge[0 + HASBIT(tlg, 0)], ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, GetBridgeHeight(ti->tile));
|
||||||
} else {
|
} else {
|
||||||
AddSortableSpriteToDraw( pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, GetBridgeHeight(ti->tile) + TILE_HEIGHT);
|
AddSortableSpriteToDraw( pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, GetBridgeHeight(ti->tile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need a pylon on the southern end of the bridge */
|
/* need a pylon on the southern end of the bridge */
|
||||||
if (DistanceMax(ti->tile, start) == length) {
|
if (DistanceMax(ti->tile, start) == length) {
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
AddSortableSpriteToDraw( pylons_bridge[0 + HASBIT(tlg, 0)], ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, GetBridgeHeight(ti->tile) + TILE_HEIGHT);
|
AddSortableSpriteToDraw( pylons_bridge[0 + HASBIT(tlg, 0)], ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, GetBridgeHeight(ti->tile));
|
||||||
} else {
|
} else {
|
||||||
AddSortableSpriteToDraw( pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, GetBridgeHeight(ti->tile) + TILE_HEIGHT);
|
AddSortableSpriteToDraw( pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, GetBridgeHeight(ti->tile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,10 @@ static uint GetBridgeHeightRamp(TileIndex t)
|
|||||||
/* Return the height there (the height of the NORTH CORNER)
|
/* Return the height there (the height of the NORTH CORNER)
|
||||||
* If the end of the bridge is on a tile with all corners except the north corner raised,
|
* If the end of the bridge is on a tile with all corners except the north corner raised,
|
||||||
* the z coordinate is 1 height level too low. Compensate for that */
|
* the z coordinate is 1 height level too low. Compensate for that */
|
||||||
return TilePixelHeight(t) + (GetTileSlope(t, NULL) == SLOPE_WSE ? TILE_HEIGHT : 0);
|
return
|
||||||
|
TilePixelHeight(t) +
|
||||||
|
(GetTileSlope(t, NULL) == SLOPE_WSE ? TILE_HEIGHT : 0) +
|
||||||
|
TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -670,7 +673,7 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
|
|||||||
v = FindVehicleBetween(
|
v = FindVehicleBetween(
|
||||||
tile + delta,
|
tile + delta,
|
||||||
endtile - delta,
|
endtile - delta,
|
||||||
GetBridgeHeightRamp(tile) + TILE_HEIGHT
|
GetBridgeHeightRamp(tile)
|
||||||
);
|
);
|
||||||
if (v != NULL) return_cmd_error(VehicleInTheWayErrMsg(v));
|
if (v != NULL) return_cmd_error(VehicleInTheWayErrMsg(v));
|
||||||
|
|
||||||
@ -1040,7 +1043,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
// get bridge sprites
|
// get bridge sprites
|
||||||
b = GetBridgeSpriteTable(GetBridgeType(ti->tile), GetBridgePiece(ti->tile)) + base_offset;
|
b = GetBridgeSpriteTable(GetBridgeType(ti->tile), GetBridgePiece(ti->tile)) + base_offset;
|
||||||
|
|
||||||
z = GetBridgeHeight(ti->tile) + 5;
|
z = GetBridgeHeight(ti->tile) - 3;
|
||||||
|
|
||||||
// draw rail or road component
|
// draw rail or road component
|
||||||
image = b[0];
|
image = b[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user