summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-28 22:03:34 +0000
committerrubidium <rubidium@openttd.org>2007-06-28 22:03:34 +0000
commit3a82c1e9ea9015ebab8613db396ab3994bce7d03 (patch)
tree16982f2678e23411b8d2c06b2eae7026e5480bad /src
parentb3c3171c1e801b0e52a720f741ac9a0cfbe17e66 (diff)
downloadopenttd-3a82c1e9ea9015ebab8613db396ab3994bce7d03.tar.xz
(svn r10381) -Fix [FS#951]: skipping an order made train reverse immediatelly. Patch by boekabart.
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ad71a7f39..4cb427b81 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2392,12 +2392,19 @@ static bool ProcessTrainOrder(Vehicle *v)
default: break;
}
+ /**
+ * Reversing because of order change is allowed only just after leaving a
+ * station (and the difficulty setting to allowed, of course)
+ * this can be detected because only after OT_LEAVESTATION, current_order
+ * will be reset to nothing. (That also happens if no order, but in that case
+ * it won't hit the point in code where may_reverse is checked)
+ */
+ bool may_reverse = v->current_order.type == OT_NOTHING;
+
/* check if we've reached the waypoint? */
- bool at_waypoint = false;
if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
- at_waypoint = true;
}
/* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
@@ -2453,7 +2460,7 @@ static bool ProcessTrainOrder(Vehicle *v)
return false;
}
- return !at_waypoint && CheckReverseTrain(v);
+ return may_reverse && CheckReverseTrain(v);
}
void Train::MarkDirty()