Changeset - r12040:4173bf3c66f8
[Not reviewed]
master
0 1 0
smatz - 15 years ago 2009-05-27 23:11:52
smatz@openttd.org
(svn r16452) -Fix: don't trigger station animations when the station was deleted in the same tick
1 file changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -2696,13 +2696,18 @@ static VehicleEnterTileStatus VehicleEnt
 
 * 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);
 
		}
 
	}
0 comments (0 inline, 0 general)