summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-17 10:19:00 +0000
committerrubidium <rubidium@openttd.org>2009-05-17 10:19:00 +0000
commit6b2f9e8c9edd6a8e5528898db0bbdb884b0221a2 (patch)
tree11aa3acb6ccf66deee909b5ff688cc1670886f06 /src/station_cmd.cpp
parent871107f52952ee59c353feab933126ed206e60bf (diff)
downloadopenttd-6b2f9e8c9edd6a8e5528898db0bbdb884b0221a2.tar.xz
(svn r16328) -Fix: desync when removing lots of stations
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index f307c8701..ef936ddfe 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2699,7 +2699,11 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
return VETSB_CONTINUE;
}
-/* this function is called for one station each tick */
+/**
+ * This function is called for each station once every 250 ticks.
+ * Not all stations will get the tick at the same time.
+ * @param st the station receiving the tick.
+ */
static void StationHandleBigTick(Station *st)
{
UpdateStationAcceptance(st, true);
@@ -2839,11 +2843,6 @@ void OnTick_Station()
{
if (_game_mode == GM_EDITOR) return;
- uint i = _station_tick_ctr;
- if (++_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0;
-
- if (Station::IsValidID(i)) StationHandleBigTick(Station::Get(i));
-
Station *st;
FOR_ALL_STATIONS(st) {
StationHandleSmallTick(st);
@@ -2852,6 +2851,7 @@ void OnTick_Station()
* Station index is included so that triggers are not all done
* at the same time. */
if ((_tick_counter + st->index) % 250 == 0) {
+ StationHandleBigTick(st);
StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS);
}
}
@@ -3211,8 +3211,6 @@ void InitializeStations()
/* Clean the roadstop pool and create 1 block in it */
_RoadStop_pool.CleanPool();
_RoadStop_pool.AddBlockToPool();
-
- _station_tick_ctr = 0;
}
static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)