From aa80687b6504b3fd9b167a740d48298e4b1c048e Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 25 Jan 2012 18:34:38 +0000 Subject: (svn r23849) -Fix [FS#5008]: when the network is lagging, you try to copy a vehicle's order but accidentally create a station order and then copy the vehicle's order (before the first command is executed) one could trigger an assertion from the pool. Simplify the ancient code and make it more fool proof, even though it could stop copying a vehicle's orders slightly earlier than it would now... but who has come near that limit and really needed that many orders? --- src/order_cmd.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 79a365f4c..aed5195fe 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1521,9 +1521,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 } /* make sure there are orders available */ - int delta = dst->IsOrderListShared() ? src->GetNumOrders() + 1 : src->GetNumOrders() - dst->GetNumOrders(); - if (!Order::CanAllocateItem(delta) || - ((dst->orders.list == NULL || dst->IsOrderListShared()) && !OrderList::CanAllocateItem())) { + if (!Order::CanAllocateItem(src->GetNumOrders()) || !OrderList::CanAllocateItem()) { return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS); } -- cgit v1.2.3-54-g00ecf