diff options
author | rubidium <rubidium@openttd.org> | 2008-08-02 22:57:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-08-02 22:57:03 +0000 |
commit | 2a567afff475178bc7472308748493aea6750bb9 (patch) | |
tree | 109a88baeefba47c5aa317c3e219ea77bceebf2d | |
parent | 14f6b1f49c0c5bf6c280c1dd4882498a64230b6d (diff) | |
download | openttd-2a567afff475178bc7472308748493aea6750bb9.tar.xz |
(svn r13965) -Add [YAPP]: Implement newgrf var 0x44 for stations (PBS reservation state). (michi_cc)
-rw-r--r-- | src/newgrf_station.cpp | 8 | ||||
-rw-r--r-- | src/pbs.cpp | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index b63703206..87e98ef91 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -26,6 +26,7 @@ #include "animated_tile_func.h" #include "functions.h" #include "tunnelbridge_map.h" +#include "rail_map.h" #include "table/sprites.h" #include "table/strings.h" @@ -405,7 +406,12 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8); case 0x43: return st->owner; // Station owner - case 0x44: return 2; // PBS status + case 0x44: + if (IsTileType(tile, MP_RAILWAY) && IsRailWaypoint(tile)) { + return GetDepotWaypointReservation(tile) ? 7 : 4; + } else { + return GetRailwayStationReservation(tile) ? 7 : 4; // PBS status + } case 0x45: if (!HasBit(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SetBit(_svc.valid, 2); } return _svc.v45; diff --git a/src/pbs.cpp b/src/pbs.cpp index 12e54d7f4..04b956fbd 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -66,7 +66,7 @@ void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bo do { SetRailwayStationReservation(tile, b); - if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(tile); + MarkTileDirtyByTile(tile); tile = TILE_ADD(tile, diff); } while (IsCompatibleTrainStationTile(tile, start)); } @@ -92,6 +92,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) if (IsRailWaypoint(tile) || IsRailDepot(tile)) { if (!GetDepotWaypointReservation(tile)) { SetDepotWaypointReservation(tile, true); + MarkTileDirtyByTile(tile); return true; } } @@ -107,6 +108,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) case MP_STATION: if (IsRailwayStation(tile) && !GetRailwayStationReservation(tile)) { SetRailwayStationReservation(tile, true); + MarkTileDirtyByTile(tile); return true; } break; @@ -139,7 +141,10 @@ bool TryReserveRailTrack(TileIndex tile, Track t) switch (GetTileType(tile)) { case MP_RAILWAY: - if (IsRailWaypoint(tile) || IsRailDepot(tile)) SetDepotWaypointReservation(tile, false); + if (IsRailWaypoint(tile) || IsRailDepot(tile)) { + SetDepotWaypointReservation(tile, false); + MarkTileDirtyByTile(tile); + } if (IsPlainRailTile(tile)) UnreserveTrack(tile, t); break; @@ -148,7 +153,10 @@ bool TryReserveRailTrack(TileIndex tile, Track t) break; case MP_STATION: - if (IsRailwayStation(tile)) SetRailwayStationReservation(tile, false); + if (IsRailwayStation(tile)) { + SetRailwayStationReservation(tile, false); + MarkTileDirtyByTile(tile); + } break; case MP_TUNNELBRIDGE: |