mirror of https://github.com/OpenTTD/OpenTTD
(svn r22024) -Fix [FS#4468]: verify we can allocate an OrderList before we actually try to do so (Rubidium)
parent
b4273bcd35
commit
364ef8e6e6
|
@ -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 (flags & DC_EXEC) {
|
||||||
/* If the destination vehicle had a OrderList, destroy it */
|
/* If the destination vehicle had a OrderList, destroy it */
|
||||||
DeleteVehicleOrders(dst);
|
DeleteVehicleOrders(dst);
|
||||||
|
|
|
@ -1332,6 +1332,10 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint3
|
||||||
CommandCost cost(EXPENSES_NEW_VEHICLES);
|
CommandCost cost(EXPENSES_NEW_VEHICLES);
|
||||||
for (Train *t = sell_head; t != NULL; t = t->Next()) cost.AddCost(-t->value);
|
for (Train *t = sell_head; t != NULL; t = t->Next()) cost.AddCost(-t->value);
|
||||||
|
|
||||||
|
if (first->orders.list == NULL && !OrderList::CanAllocateItem()) {
|
||||||
|
return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
|
||||||
|
}
|
||||||
|
|
||||||
/* do it? */
|
/* do it? */
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
/* First normalise the sub types of the chain. */
|
/* First normalise the sub types of the chain. */
|
||||||
|
|
Loading…
Reference in New Issue