mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 15:30:00 +00:00
(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?
This commit is contained in:
parent
6dc33ed4b5
commit
aa80687b65
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user