summaryrefslogtreecommitdiff
path: root/src/pbs.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2013-01-11 07:39:25 +0000
committerpeter1138 <peter1138@openttd.org>2013-01-11 07:39:25 +0000
commitc00a400cc7e7626a430ed65d29a47c02a7a14eaa (patch)
tree0936d13989bc82bcc8bf50026d2ba55f7afed7ee /src/pbs.cpp
parent4ebbfc3de4a50b6cf73a7fe50dd17ac1e42efb92 (diff)
downloadopenttd-c00a400cc7e7626a430ed65d29a47c02a7a14eaa.tar.xz
(svn r24905) -Feature(ish): Implement station randomisation triggers.
Diffstat (limited to 'src/pbs.cpp')
-rw-r--r--src/pbs.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pbs.cpp b/src/pbs.cpp
index 2e0919b0f..68069c0f9 100644
--- a/src/pbs.cpp
+++ b/src/pbs.cpp
@@ -12,6 +12,7 @@
#include "stdafx.h"
#include "viewport_func.h"
#include "vehicle_func.h"
+#include "newgrf_station.h"
#include "pathfinder/follow_track.hpp"
/**
@@ -72,10 +73,11 @@ void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool
* Try to reserve a specific track on a tile
* @param tile the tile
* @param t the track
+ * @param trigger_stations whether to call station randomisation trigger
* @return \c true if reservation was successful, i.e. the track was
* free and didn't cross any other reserved tracks.
*/
-bool TryReserveRailTrack(TileIndex tile, Track t)
+bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
{
assert((GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & TrackToTrackBits(t)) != 0);
@@ -108,6 +110,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t)
case MP_STATION:
if (HasStationRail(tile) && !HasStationReservation(tile)) {
SetRailStationReservation(tile, true);
+ if (trigger_stations) TriggerStationRandomisation(NULL, tile, SRT_PATH_RESERVATION);
MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track
return true;
}