diff --git a/src/lang/english.txt b/src/lang/english.txt index 77d2816404..77303bdf12 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1389,6 +1389,8 @@ STR_CONFIG_SETTING_STATION_SPREAD :Maximum station STR_CONFIG_SETTING_STATION_SPREAD_HELPTEXT :Maximum area the parts of a single station may be spread out on. Note that high values will slow the game STR_CONFIG_SETTING_SERVICEATHELIPAD :Service helicopters at helipads automatically: {STRING2} STR_CONFIG_SETTING_SERVICEATHELIPAD_HELPTEXT :Service helicopters after every landing, even if there is no depot at the airport +STR_CONFIG_SETTING_NONSTOP_ORDER_ONLY :Only allow non-stop orders: {STRING2} +STR_CONFIG_SETTING_NONSTOP_ORDER_ONLY_HELPTEXT :Only allow creating non-stop orders for trains and road vehicles STR_CONFIG_SETTING_LINK_TERRAFORM_TOOLBAR :Link landscape toolbar to rail/road/water/airport toolbars: {STRING2} STR_CONFIG_SETTING_LINK_TERRAFORM_TOOLBAR_HELPTEXT :When opening a construction toolbar for a transport type, also open the toolbar for terraforming STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR :Land colour used at the smallmap: {STRING2} diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 67da9e9c31..1e3b0af420 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -904,6 +904,7 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 /* Non stop only allowed for ground vehicles. */ if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && !v->IsGroundVehicle()) return CMD_ERROR; + if (_settings_game.order.nonstop_only && !(new_order.GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) && v->IsGroundVehicle()) return CMD_ERROR; /* Filter invalid load/unload types. */ switch (new_order.GetLoadType()) { @@ -973,6 +974,7 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 } if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && !v->IsGroundVehicle()) return CMD_ERROR; + if (_settings_game.order.nonstop_only && !(new_order.GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) && v->IsGroundVehicle()) return CMD_ERROR; if (new_order.GetDepotOrderType() & ~(ODTFB_PART_OF_ORDERS | ((new_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0 ? ODTFB_SERVICE : 0))) return CMD_ERROR; if (new_order.GetDepotActionType() & ~(ODATFB_HALT | ODATFB_SELL | ODATFB_NEAREST_DEPOT)) return CMD_ERROR; if ((new_order.GetDepotOrderType() & ODTFB_SERVICE) && (new_order.GetDepotActionType() & ODATFB_HALT)) return CMD_ERROR; @@ -1007,6 +1009,7 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 * [non-stop] * non-stop orders (if any) are only valid for trains */ if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && v->type != VEH_TRAIN) return CMD_ERROR; + if (_settings_game.order.nonstop_only && !(new_order.GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) && v->type == VEH_TRAIN) return CMD_ERROR; break; } @@ -1558,6 +1561,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 if (!v->IsGroundVehicle()) return CMD_ERROR; if (data >= ONSF_END) return CMD_ERROR; if (data == order->GetNonStopType()) return CMD_ERROR; + if (_settings_game.order.nonstop_only && !(data & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) && v->IsGroundVehicle()) return CMD_ERROR; break; case MOF_STOP_LOCATION: diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 9211b3745a..a289bbe22f 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -957,7 +957,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsInfraTileUsageAllowed(v->type, v->owner, tile)) { order.MakeGoToDepot(v->type == VEH_AIRCRAFT ? GetStationIndex(tile) : GetDepotIndex(tile), ODTFB_PART_OF_ORDERS, - (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); + ((_settings_client.gui.new_nonstop || _settings_game.order.nonstop_only) && v->IsGroundVehicle()) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); @@ -969,7 +969,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) v->type == VEH_TRAIN && IsInfraTileUsageAllowed(VEH_TRAIN, v->owner, tile)) { order.MakeGoToWaypoint(GetStationIndex(tile)); - if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION); + if (_settings_client.gui.new_nonstop != _ctrl_pressed || _settings_game.order.nonstop_only) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION); return order; } @@ -993,7 +993,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (st->facilities & facil) { order.MakeGoToStation(st_index); if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY); - if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); + if ((_settings_client.gui.new_nonstop || _settings_game.order.nonstop_only) && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_END); return order; } @@ -1248,7 +1248,7 @@ private: order.next = NULL; order.index = 0; order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS, - _settings_client.gui.new_nonstop && this->vehicle->IsGroundVehicle() ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); + (_settings_client.gui.new_nonstop || _settings_game.order.nonstop_only) && this->vehicle->IsGroundVehicle() ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); order.SetDepotActionType(ODATFB_NEAREST_DEPOT); DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER)); @@ -1993,7 +1993,7 @@ public: this->OrderClick_Nonstop(-1); } else { const Order *o = this->vehicle->GetOrder(this->OrderGetSel()); - ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), WID_O_NON_STOP, 0, + ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), WID_O_NON_STOP, _settings_game.order.nonstop_only ? 5 : 0, o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12), 0, DDSF_LOST_FOCUS); } break; diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp index 88f153adca..fb25b6efc2 100644 --- a/src/saveload/order_sl.cpp +++ b/src/saveload/order_sl.cpp @@ -28,7 +28,7 @@ void Order::ConvertFromOldSavegame() this->flags = 0; /* First handle non-stop - use value from savegame if possible, else use value from config file */ - if (_settings_client.gui.sg_new_nonstop || (IsSavegameVersionBefore(SLV_22) && _savegame_type != SGT_TTO && _savegame_type != SGT_TTD && _settings_client.gui.new_nonstop)) { + if (_settings_client.gui.sg_new_nonstop || (IsSavegameVersionBefore(SLV_22) && _savegame_type != SGT_TTO && _savegame_type != SGT_TTD && (_settings_client.gui.new_nonstop || _settings_game.order.nonstop_only))) { /* OFB_NON_STOP */ this->SetNonStopType((old_flags & 8) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); } else { diff --git a/src/script/api/script_order.cpp b/src/script/api/script_order.cpp index 486668497d..dd793460cc 100644 --- a/src/script/api/script_order.cpp +++ b/src/script/api/script_order.cpp @@ -504,7 +504,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr return false; } - order.SetNonStopType((OrderNonStopFlags)GB(order_flags, 0, 2)); + order.SetNonStopType((OrderNonStopFlags)(GB(order_flags, 0, 2) | ((_settings_game.order.nonstop_only && ::Vehicle::Get(vehicle_id)->IsGroundVehicle()) ? OF_NON_STOP_INTERMEDIATE : 0))); int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position); return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), order.Pack(), CMD_INSERT_ORDER); @@ -573,6 +573,7 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance) VehicleID vehicle_id = (VehicleID)ScriptObject::GetCallbackVariable(0); OrderPosition order_position = (OrderPosition)ScriptObject::GetCallbackVariable(1); ScriptOrderFlags order_flags = (ScriptOrderFlags)ScriptObject::GetCallbackVariable(2); + if (_settings_game.order.nonstop_only && ::Vehicle::Get(vehicle_id)->IsGroundVehicle()) order_flags |= OF_NON_STOP_INTERMEDIATE; order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 5b6e88aa9d..0f0ecfd833 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1715,6 +1715,7 @@ static SettingsContainer &GetSettingsTree() vehicles->Add(new SettingEntry("order.no_servicing_if_no_breakdowns")); vehicles->Add(new SettingEntry("order.serviceathelipad")); + vehicles->Add(new SettingEntry("order.nonstop_only")); vehicles->Add(new SettingEntry("vehicle.adjacent_crossings")); vehicles->Add(new SettingEntry("vehicle.safer_crossings")); vehicles->Add(new SettingEntry("vehicle.flip_direction_all_trains")); diff --git a/src/settings_type.h b/src/settings_type.h index a62ed65c7c..56b879da17 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -513,6 +513,7 @@ struct OrderSettings { bool selectgoods; ///< only send the goods to station if a train has been there bool no_servicing_if_no_breakdowns; ///< don't send vehicles to depot when breakdowns are disabled bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot) + bool nonstop_only; ///< allow non-stop orders only uint8 old_occupancy_smoothness; ///< moved to company settings: percentage smoothness of occupancy measurement changes bool old_timetable_separation; ///< moved to company settings: whether to perform automatic separation based on timetable diff --git a/src/table/settings.ini b/src/table/settings.ini index f403fe9663..12e21f1daa 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1430,6 +1430,15 @@ str = STR_CONFIG_SETTING_SERVICEATHELIPAD strhelp = STR_CONFIG_SETTING_SERVICEATHELIPAD_HELPTEXT cat = SC_EXPERT +[SDT_BOOL] +base = GameSettings +var = order.nonstop_only +def = false +str = STR_CONFIG_SETTING_NONSTOP_ORDER_ONLY +strhelp = STR_CONFIG_SETTING_NONSTOP_ORDER_ONLY_HELPTEXT +cat = SC_EXPERT +patxname = ""nonstop_only.order.nonstop_only"" + [SDT_BOOL] base = GameSettings var = station.modified_catchment