summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-04-24 07:44:21 +0000
committerpeter1138 <peter1138@openttd.org>2008-04-24 07:44:21 +0000
commit6ac8ced9afbb3f7576a18b3ebb64d88a8653d990 (patch)
treea2e290da014fce01babeca764e6aeb0a95bbf5be
parentb2717d1426fb6c21987eee9754cf1cd1613a8a29 (diff)
downloadopenttd-6ac8ced9afbb3f7576a18b3ebb64d88a8653d990.tar.xz
(svn r12860) -Fix [FS#1947]: Train depart animation trigger was not called in some cases.
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 681f369cc..26a5134aa 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2231,8 +2231,6 @@ void Train::PlayLeaveStationSound() const
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;
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 54526ddc0..092ef72e7 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -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 @@ void Vehicle::LeaveStation()
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);
}