summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
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);