summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-11 18:49:03 +0000
committerrubidium <rubidium@openttd.org>2009-12-11 18:49:03 +0000
commitdb4e547e2418340a9c399c1becdad98231d0a44e (patch)
tree8573e20986a83fc6c91cde0f4ed0b3362454075b /src
parent745a6d72d1b0cbd366cbd46c4fbf771332adc115 (diff)
downloadopenttd-db4e547e2418340a9c399c1becdad98231d0a44e.tar.xz
(svn r18461) -Fix (r18456): when moving a wagon from the front of a train one could make a train 1 longer than allowed
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 138ab381f..5efcb9789 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1112,7 +1112,9 @@ static CommandCost CheckNewTrainLength(const Train *dst_head, const Train *src_h
* will be within the required lengths. */
if (src_len + dst_len <= max_len) return CommandCost();
- if (!move_chain && !src_head->IsFrontEngine() && src_head == src && (src_len - 1) > max_len) {
+ if (!move_chain && !src_head->IsFrontEngine() && src_head == src &&
+ /* First case moving within, second is make a new one */
+ (src_head == dst_head ? src_len : src_len - 1) > max_len) {
/* Moving of a *single* non-engine at the front of the chain,
* i.e. a free wagon list. If the next unit is an engine a new
* train will be created instead of removing a vehicle from a