summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-25 18:34:38 +0000
committerrubidium <rubidium@openttd.org>2012-01-25 18:34:38 +0000
commitaa80687b6504b3fd9b167a740d48298e4b1c048e (patch)
tree28b201c10640aabc75894cf4d96e4efaeba13f61 /src
parent6dc33ed4b52129c0eec768be1ae0947555b2f18d (diff)
downloadopenttd-aa80687b6504b3fd9b167a740d48298e4b1c048e.tar.xz
(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?
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp4
1 files changed, 1 insertions, 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);
}