MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CmdForceTrainProceed

Function CmdForceTrainProceed

src/train_cmd.cpp:2170–2190  ·  view source on GitHub ↗

* Force a train through a red signal * @param flags type of operation * @param veh_id train to ignore the red signal * @return the cost of this operation or an error */

Source from the content-addressed store, hash-verified

2168 * @return the cost of this operation or an error
2169 */
2170CommandCost CmdForceTrainProceed(DoCommandFlags flags, VehicleID veh_id)
2171{
2172 Train *t = Train::GetIfValid(veh_id);
2173 if (t == nullptr) return CMD_ERROR;
2174
2175 if (!t->IsPrimaryVehicle()) return CMD_ERROR;
2176
2177 CommandCost ret = CheckOwnership(t->owner);
2178 if (ret.Failed()) return ret;
2179
2180
2181 if (flags.Test(DoCommandFlag::Execute)) {
2182 t->force_proceed = DetermineNextTrainForceProceeding(t);
2183 SetWindowDirty(WC_VEHICLE_VIEW, t->index);
2184
2185 /* Unbunching data is no longer valid. */
2186 t->ResetDepotUnbunching();
2187 }
2188
2189 return CommandCost();
2190}
2191
2192/**
2193 * Try to find a depot nearby.

Callers

nothing calls this directly

Calls 8

CheckOwnershipFunction · 0.85
SetWindowDirtyFunction · 0.85
CommandCostClass · 0.85
FailedMethod · 0.80
TestMethod · 0.80
ResetDepotUnbunchingMethod · 0.80
IsPrimaryVehicleMethod · 0.45

Tested by

no test coverage detected