diff options
author | frosch <frosch@openttd.org> | 2015-03-28 14:04:06 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2015-03-28 14:04:06 +0000 |
commit | beb213f9eec6696133d662ed7542f4b2272b52a2 (patch) | |
tree | 29d3e48db8887e55b79c85cfc3a6bf030b80cee2 | |
parent | 8f03a02efc6fee08dac0d4481197da5a2c194b3b (diff) | |
download | openttd-beb213f9eec6696133d662ed7542f4b2272b52a2.tar.xz |
(svn r27209) -Add: Draw path reservation on the whole bridge, not only on the bridge heads.
-rw-r--r-- | src/pbs.cpp | 12 | ||||
-rw-r--r-- | src/train_cmd.cpp | 8 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 10 |
3 files changed, 26 insertions, 4 deletions
diff --git a/src/pbs.cpp b/src/pbs.cpp index 76cb3b9d6..133293909 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -85,7 +85,11 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations) if (_settings_client.gui.show_track_reservation) { /* show the reserved rail if needed */ - MarkTileDirtyByTile(tile); + if (IsBridgeTile(tile)) { + MarkBridgeDirty(tile); + } else { + MarkTileDirtyByTile(tile); + } } switch (GetTileType(tile)) { @@ -141,7 +145,11 @@ void UnreserveRailTrack(TileIndex tile, Track t) assert((GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & TrackToTrackBits(t)) != 0); if (_settings_client.gui.show_track_reservation) { - MarkTileDirtyByTile(tile); + if (IsBridgeTile(tile)) { + MarkBridgeDirty(tile); + } else { + MarkTileDirtyByTile(tile); + } } switch (GetTileType(tile)) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 45817159b..8f20973b3 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2216,8 +2216,12 @@ static void ClearPathReservation(const Train *v, TileIndex tile, Trackdir track_ SetTunnelBridgeReservation(end, false); if (_settings_client.gui.show_track_reservation) { - MarkTileDirtyByTile(tile); - MarkTileDirtyByTile(end); + if (IsBridge(tile)) { + MarkBridgeDirty(tile); + } else { + MarkTileDirtyByTile(tile); + MarkTileDirtyByTile(end); + } } } } diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index f77ef1333..574f07ae4 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1481,6 +1481,16 @@ void DrawBridgeMiddle(const TileInfo *ti) AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES)); } } + + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && !IsInvisibilitySet(TO_BRIDGES) && HasTunnelBridgeReservation(rampnorth)) { + if (rti->UsesOverlay()) { + SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY); + AddSortableSpriteToDraw(overlay + RTO_X + axis, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES)); + } else { + AddSortableSpriteToDraw(axis == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES)); + } + } + EndSpriteCombine(); if (HasCatenaryDrawn(GetRailType(rampsouth))) { |