Fix: Clear rail vehicle flipped flag if reverse probability callback returns false. (#14281)
This now distinguishes between not-flipped and callback not implemented.
This commit is contained in:
+5
-1
@@ -906,7 +906,11 @@ std::tuple<CommandCost, VehicleID> CmdCloneVehicle(DoCommandFlags flags, TileInd
|
||||
w = Vehicle::Get(new_veh_id);
|
||||
|
||||
if (v->type == VEH_TRAIN && Train::From(v)->flags.Test(VehicleRailFlag::Flipped)) {
|
||||
Train::From(w)->flags.Set(VehicleRailFlag::Flipped);
|
||||
/* Only copy the reverse state if neither old or new vehicle implements reverse-on-build probability callback. */
|
||||
if (!TestVehicleBuildProbability(v, v->engine_type, BuildProbabilityType::Reversed).has_value() &&
|
||||
!TestVehicleBuildProbability(w, w->engine_type, BuildProbabilityType::Reversed).has_value()) {
|
||||
Train::From(w)->flags.Set(VehicleRailFlag::Flipped);
|
||||
}
|
||||
}
|
||||
|
||||
if (v->type == VEH_TRAIN && !v->IsFrontEngine()) {
|
||||
|
||||
Reference in New Issue
Block a user