1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-16 19:19:09 +00:00

Fix: reverse train direction command did not validate the given vehicle properly (#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.
This commit is contained in:
Patric Stout
2022-07-09 12:28:20 +02:00
committed by GitHub
parent 055121df80
commit 979704271b

View File

@@ -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) {