Skip to content

Commit

Permalink
Fix: reverse train direction command did not validate the given vehic…
Browse files Browse the repository at this point in the history
…le properly (OpenTTD#9947)

You could give a wagon in the chain to reverse (which makes no
functional sense ofc). In result, only parts of the vehicle were
reversing, leading to weird crashes.
  • Loading branch information
TrueBrain authored and Joel-Milligan committed Nov 10, 2022
1 parent 672476e commit 27ed640
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/train_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 1936,7 @@ CommandCost CmdReverseTrainDirection(DoCommandFlag flags, VehicleID veh_id, bool
}
} else {
/* turn the whole train around */
if (!v->IsPrimaryVehicle()) return CMD_ERROR;
if ((v->vehstatus & VS_CRASHED) || v->breakdown_ctr != 0) return CMD_ERROR;

if (flags & DC_EXEC) {
Expand Down

0 comments on commit 27ed640

Please sign in to comment.