summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/economy.cpp1
-rw-r--r--src/train_cmd.cpp4
-rw-r--r--src/vehicle_gui.cpp2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 210ff0d49..53d405e47 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1256,6 +1256,7 @@ void PrepareUnload(Vehicle *front_v)
static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
{
assert(v->current_order.IsType(OT_LOADING));
+ assert(v->load_unload_time_rem != 0);
/* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) {
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index a85b16f95..172ca934f 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1644,6 +1644,10 @@ static void MarkTrainAsStuck(Train *v)
if (!HasBit(v->flags, VRF_TRAIN_STUCK)) {
/* It is the first time the problem occured, set the "train stuck" flag. */
SetBit(v->flags, VRF_TRAIN_STUCK);
+
+ /* When loading the vehicle is already stopped. No need to change that. */
+ if (v->current_order.IsType(OT_LOADING)) return;
+
v->load_unload_time_rem = 0;
/* Stop train */
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 0f0c353f1..6a39125aa 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1916,7 +1916,7 @@ struct VehicleViewWindow : Window {
} else { // no train
str = STR_VEHICLE_STATUS_STOPPED;
}
- } else if (v->type == VEH_TRAIN && HasBit(Train::From(v)->flags, VRF_TRAIN_STUCK)) {
+ } else if (v->type == VEH_TRAIN && HasBit(Train::From(v)->flags, VRF_TRAIN_STUCK) && !v->current_order.IsType(OT_LOADING)) {
str = STR_TRAIN_STUCK;
} else { // vehicle is in a "normal" state, show current order
switch (v->current_order.GetType()) {