mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-02 20:34:41 +00:00
(svn r16452) -Fix: don't trigger station animations when the station was deleted in the same tick
This commit is contained in:
parent
5cd998b7a4
commit
45af2a294c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user