diff options
author | rubidium <rubidium@openttd.org> | 2009-12-12 23:24:11 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-12 23:24:11 +0000 |
commit | d3e754fa6f4f213a79b29130fe54cdbd7950b546 (patch) | |
tree | 515f618380cc334f7bcc3f9ad18db60061f001c2 /src | |
parent | f4e7eba2e2c300e670d70577eb5c0e77a80bb66f (diff) | |
download | openttd-d3e754fa6f4f213a79b29130fe54cdbd7950b546.tar.xz |
(svn r18473) -Fix (r18470): crash when moving a multiheaded part to be just after itself
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 5132edbd3..294f4a6c4 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1368,9 +1368,12 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u if (src->IsRearDualheaded()) return_cmd_error(STR_ERROR_REAR_ENGINE_FOLLOW_FRONT); - /* when moving all wagons, we can't have the same src_head and dst_head */ + /* When moving all wagons, we can't have the same src_head and dst_head */ if (move_chain && src_head == dst_head) return CommandCost(); + /* When moving a multiheaded part to be place after itself, bail out. */ + if (!move_chain && dst->IsRearDualheaded() && src == dst->other_multiheaded_part) return CommandCost(); + /* Check if all vehicles in the source train are stopped inside a depot. */ if (!src_head->IsStoppedInDepot()) return_cmd_error(STR_ERROR_TRAINS_CAN_ONLY_BE_ALTERED_INSIDE_A_DEPOT); |