From 4784c3ac3ca5a70b52ea39618cb3028b90b7a647 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 15 Jan 2011 18:16:46 +0000 Subject: [PATCH] (svn r21808) -Fix: don't create automatic orders when there are no manual orders (fonsinchen) --- src/vehicle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ae520718b0..95b4245fba 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);