diff options
author | smatz <smatz@openttd.org> | 2009-05-27 23:11:52 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-27 23:11:52 +0000 |
commit | 45af2a294c813eb87fe130d0fbcdba0af254963e (patch) | |
tree | 2232937ec1803788f0063e5fcc72962934fdb7eb /src | |
parent | 5cd998b7a42ef7e6f57ac0fe5161f638d9fdf4f4 (diff) | |
download | openttd-45af2a294c813eb87fe130d0fbcdba0af254963e.tar.xz |
(svn r16452) -Fix: don't trigger station animations when the station was deleted in the same tick
Diffstat (limited to 'src')
-rw-r--r-- | src/station_cmd.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index d2403bb4f..4e5bb3c06 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2696,13 +2696,18 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i * 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. + * @return true if the station is still valid (wasn't deleted) */ -static void StationHandleBigTick(Station *st) +static bool StationHandleBigTick(Station *st) { UpdateStationAcceptance(st, true); - if (st->facilities == 0 && ++st->delete_ctr >= 8) delete st; + if (st->facilities == 0 && ++st->delete_ctr >= 8) { + delete st; + return false; + } + return true; } static inline void byte_inc_sat(byte *p) @@ -2844,7 +2849,8 @@ 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); + /* Stop processing this station if it was deleted */ + if (!StationHandleBigTick(st)) continue; StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS); } } |