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

Method SetStopLocation

src/script/api/script_order.cpp:431–443  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

429}
430
431/* static */ bool ScriptOrder::SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location)
432{
433 EnforceCompanyModeValid(false);
434 EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
435 EnforcePrecondition(false, ScriptVehicle::GetVehicleType(vehicle_id) == ScriptVehicle::VT_RAIL);
436 EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position));
437 EnforcePrecondition(false, stop_location >= STOPLOCATION_NEAR && stop_location <= STOPLOCATION_FAR);
438
439 order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
440
441 int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
442 return ScriptObject::Command<CMD_MODIFY_ORDER>::Do(0, vehicle_id, order_pos, MOF_STOP_LOCATION, stop_location);
443}
444
445/* static */ bool ScriptOrder::SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoType refit_cargo)
446{

Callers 2

InsertOrderMethod · 0.45
AfterLoadGameFunction · 0.45

Tested by

no test coverage detected