1
0
Fork 0

(svn r27419) -Fix [FS#6369]: CmdSellRailWagon did not revert all actions properly when no orderlist could be allocated. (Juanjo)

release/1.6
frosch 2015-10-30 16:18:39 +00:00
parent 22e6a2590d
commit 378653100b
1 changed files with 5 additions and 3 deletions

View File

@ -1386,13 +1386,15 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint3
return ret;
}
CommandCost cost(EXPENSES_NEW_VEHICLES);
for (Train *t = sell_head; t != NULL; t = t->Next()) cost.AddCost(-t->value);
if (first->orders.list == NULL && !OrderList::CanAllocateItem()) {
/* Restore the train we had. */
RestoreTrainBackup(original);
return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
}
CommandCost cost(EXPENSES_NEW_VEHICLES);
for (Train *t = sell_head; t != NULL; t = t->Next()) cost.AddCost(-t->value);
/* do it? */
if (flags & DC_EXEC) {
/* First normalise the sub types of the chain. */