summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-08 18:29:30 +0000
committersmatz <smatz@openttd.org>2011-02-08 18:29:30 +0000
commit364ef8e6e6342f8f777da561571422c8c57c402b (patch)
treefaa555f8504b98667832b5530583d93aba633f85 /src/train_cmd.cpp
parentb4273bcd35d4d0083dc9bd88a207283b4e3ba014 (diff)
downloadopenttd-364ef8e6e6342f8f777da561571422c8c57c402b.tar.xz
(svn r22024) -Fix [FS#4468]: verify we can allocate an OrderList before we actually try to do so (Rubidium)
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 61cd3ca5e..9746fd403 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1332,6 +1332,10 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint3
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()) {
+ return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
+ }
+
/* do it? */
if (flags & DC_EXEC) {
/* First normalise the sub types of the chain. */