* 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 */
| 2168 | * @return the cost of this operation or an error |
| 2169 | */ |
| 2170 | CommandCost 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. |
nothing calls this directly
no test coverage detected