From 7af2470a78d73ac2953a6ed2eb36bca15c03d3e4 Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 8 Feb 2011 18:21:55 +0000 Subject: [PATCH] (svn r22022) -Fix [FS#4468]: verify we can allocate an order before we actually try to do so --- src/vehicle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 14f7c9bf4c..ec78d8f428 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1849,7 +1849,8 @@ void Vehicle::BeginLoading() Order *in_list = this->GetOrder(this->cur_auto_order_index); if (in_list != NULL && this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID && (!in_list->IsType(OT_AUTOMATIC) || - in_list->GetDestination() != this->last_station_visited)) { + in_list->GetDestination() != this->last_station_visited) && + Order::CanAllocateItem()) { Order *auto_order = new Order(); auto_order->MakeAutomatic(this->last_station_visited); InsertOrder(this, auto_order, this->cur_auto_order_index); @@ -2226,7 +2227,7 @@ void Vehicle::AddToShared(Vehicle *shared_chain) { assert(this->previous_shared == NULL && this->next_shared == NULL); - if (!shared_chain->orders.list) { + if (shared_chain->orders.list == NULL) { assert(shared_chain->previous_shared == NULL); assert(shared_chain->next_shared == NULL); this->orders.list = shared_chain->orders.list = new OrderList(NULL, shared_chain);