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

Method SetOrderCompareValue

src/script/api/script_order.cpp:419–429  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

417}
418
419/* static */ bool ScriptOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, SQInteger value)
420{
421 EnforceCompanyModeValid(false);
422 EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
423 EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
424 EnforcePrecondition(false, value >= 0 && value < 2048);
425 if (GetOrderCondition(vehicle_id, order_position) == OC_MAX_SPEED) value = value * 10 / 16;
426
427 int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
428 return ScriptObject::Command<CMD_MODIFY_ORDER>::Do(0, vehicle_id, order_pos, MOF_COND_VALUE, value);
429}
430
431/* static */ bool ScriptOrder::SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location)
432{

Callers

nothing calls this directly

Tested by

no test coverage detected