(svn r22024) -Fix [FS#4468]: verify we can allocate an OrderList before we actually try to do so (Rubidium)

This commit is contained in:
smatz
2011-02-08 18:29:30 +00:00
parent b4273bcd35
commit 364ef8e6e6
2 changed files with 8 additions and 0 deletions

View File

@@ -1389,6 +1389,10 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
}
if (src->orders.list == NULL && !OrderList::CanAllocateItem()) {
return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
}
if (flags & DC_EXEC) {
/* If the destination vehicle had a OrderList, destroy it */
DeleteVehicleOrders(dst);