(svn r12860) -Fix [FS#1947]: Train depart animation trigger was not called in some cases.
authorpeter1138
Thu, 24 Apr 2008 07:44:21 +0000
changeset 10319 77f1149ee0c9
parent 10318 e66f24f12a84
child 10320 45f86af65da1
(svn r12860) -Fix [FS#1947]: Train depart animation trigger was not called in some cases.
src/train_cmd.cpp
src/vehicle.cpp
--- a/src/train_cmd.cpp	Wed Apr 23 22:55:11 2008 +0000
+++ b/src/train_cmd.cpp	Thu Apr 24 07:44:21 2008 +0000
@@ -2231,8 +2231,6 @@
 		SND_41_MAGLEV
 	};
 
-	if (IsTileType(this->tile, MP_STATION)) StationAnimationTrigger(NULL, this->tile, STAT_ANIM_TRAIN_DEPARTS);
-
 	if (PlayVehicleSound(this, VSE_START)) return;
 
 	EngineID engtype = this->engine_type;
--- a/src/vehicle.cpp	Wed Apr 23 22:55:11 2008 +0000
+++ b/src/vehicle.cpp	Thu Apr 24 07:44:21 2008 +0000
@@ -30,6 +30,7 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_engine.h"
 #include "newgrf_sound.h"
+#include "newgrf_station.h"
 #include "group.h"
 #include "order_func.h"
 #include "strings_func.h"
@@ -2562,10 +2563,14 @@
 	if (current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
 
 	current_order.MakeLeaveStation();
-	GetStation(this->last_station_visited)->loading_vehicles.remove(this);
+	Station *st = GetStation(this->last_station_visited);
+	st->loading_vehicles.remove(this);
 
 	HideFillingPercent(this->fill_percent_te_id);
 	this->fill_percent_te_id = INVALID_TE_ID;
+
+	/* Trigger station animation for trains only */
+	if (this->type == VEH_TRAIN && IsTileType(this->tile, MP_STATION)) StationAnimationTrigger(st, this->tile, STAT_ANIM_TRAIN_DEPARTS);
 }