summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-15 18:16:46 +0000
committerrubidium <rubidium@openttd.org>2011-01-15 18:16:46 +0000
commit4784c3ac3ca5a70b52ea39618cb3028b90b7a647 (patch)
treeeb3854d0dc3444da4f74c9c9e066a28ef9523579 /src/vehicle.cpp
parentbc9afec3b0f5f0b3f1c7a0f0494e9c3c42e71bec (diff)
downloadopenttd-4784c3ac3ca5a70b52ea39618cb3028b90b7a647.tar.xz
(svn r21808) -Fix: don't create automatic orders when there are no manual orders (fonsinchen)
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index ae520718b..95b4245fb 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1770,12 +1770,12 @@ void Vehicle::BeginLoading()
} else {
/* We weren't scheduled to stop here. Insert an automatic order
- * to show that we are stopping here. */
+ * to show that we are stopping here, but only do that if the order
+ * list isn't empty. */
Order *in_list = this->GetOrder(this->cur_order_index);
- if ((this->orders.list == NULL || this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID) &&
- ((in_list == NULL && this->cur_order_index == 0) ||
- (in_list != NULL && (!in_list->IsType(OT_AUTOMATIC) ||
- in_list->GetDestination() != this->last_station_visited)))) {
+ if (in_list != NULL && this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID &&
+ (!in_list->IsType(OT_AUTOMATIC) ||
+ in_list->GetDestination() != this->last_station_visited)) {
Order *auto_order = new Order();
auto_order->MakeAutomatic(this->last_station_visited);
InsertOrder(this, auto_order, this->cur_order_index);