Add company setting for remain at station if next order for same station
Set value on load for whether the save version had this enabled for trains
This commit is contained in:
@@ -2197,7 +2197,8 @@ static bool AircraftEventHandler(Aircraft *v, int loop)
|
||||
ProcessOrders(v);
|
||||
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == station_id &&
|
||||
v->targetairport == station_id && IsAirportTile(v->tile) && GetStationIndex(v->tile) == station_id) {
|
||||
v->targetairport == station_id && IsAirportTile(v->tile) && GetStationIndex(v->tile) == station_id &&
|
||||
Company::Get(v->owner)->settings.remain_if_next_order_same_station) {
|
||||
AircraftEntersTerminal(v);
|
||||
return true;
|
||||
}
|
||||
|
@@ -707,6 +707,9 @@ STR_CONFIG_SETTING_ADVANCE_ORDER_ON_CLONE_HELPTEXT :After cloning a
|
||||
STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP :Add vehicle to group on copy-clone: {STRING2}
|
||||
STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT :Set whether cloned vehicles which do not share orders are added to the copied vehicle's group.
|
||||
|
||||
STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION :Remain in station if next order is for same station: {STRING2}
|
||||
STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION_HELPTEXT :If a vehicle's next order is for the same station it would be about to leave, start loading/unloading again instead of leaving.
|
||||
|
||||
STR_CONFIG_SETTING_SCENARIO_MULTIPLE_BUILDINGS :Allow multiple churches/stadiums: {STRING2}
|
||||
STR_CONFIG_SETTING_SCENARIO_MULTIPLE_BUILDINGS_HELPTEXT :Allow manually adding churches and stadiums when there is already one present in the town.
|
||||
|
||||
|
@@ -1580,7 +1580,7 @@ inline byte IncreaseOvertakingCounter(RoadVehicle *v)
|
||||
|
||||
static bool CheckRestartLoadingAtRoadStop(RoadVehicle *v)
|
||||
{
|
||||
if (v->GetNumOrders() < 1) return false;
|
||||
if (v->GetNumOrders() < 1 || !Company::Get(v->owner)->settings.remain_if_next_order_same_station) return false;
|
||||
|
||||
StationID station_id = v->current_order.GetDestination();
|
||||
VehicleOrderID next_order_idx = AdvanceOrderIndexDeferred(v, v->cur_implicit_order_index);
|
||||
|
@@ -4139,6 +4139,13 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (SlXvIsFeatureMissing(XSLFI_REMAIN_NEXT_ORDER_STATION)) {
|
||||
for (Company *c : Company::Iterate()) {
|
||||
/* Approximately the same time as when this was feature was added and unconditionally enabled */
|
||||
c->settings.remain_if_next_order_same_station = SlXvIsFeaturePresent(XSLFI_TRACE_RESTRICT_TUNBRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
InitializeRoadGUI();
|
||||
|
||||
/* This needs to be done after conversion. */
|
||||
|
@@ -186,6 +186,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_NEWGRF_ENTITY_EXTRA, XSCF_NULL, 1, 1, "newgrf_entity_extra", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_TNNC_CHUNK, XSCF_IGNORABLE_ALL, 0, 1, "tnnc_chunk", nullptr, nullptr, "TNNC" },
|
||||
{ XSLFI_MULTI_CARGO_SHIPS, XSCF_NULL, 1, 1, "multi_cargo_ships", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_REMAIN_NEXT_ORDER_STATION, XSCF_IGNORABLE_UNKNOWN, 1, 1, "remain_next_order_station", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_U64_TICK_COUNTER, XSCF_NULL, 1, 1, "u64_tick_counter", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_LINKGRAPH_TRAVEL_TIME, XSCF_NULL, 1, 1, "linkgraph_travel_time", nullptr, nullptr, nullptr },
|
||||
|
@@ -137,6 +137,7 @@ enum SlXvFeatureIndex {
|
||||
XSLFI_NEWGRF_ENTITY_EXTRA, ///< NewGRF entity mappings are 16 bit
|
||||
XSLFI_TNNC_CHUNK, ///< TNNC chunk
|
||||
XSLFI_MULTI_CARGO_SHIPS, ///< Multi-cargo ships
|
||||
XSLFI_REMAIN_NEXT_ORDER_STATION, ///< Remain in station if next order is for same station
|
||||
|
||||
XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64
|
||||
XSLFI_U64_TICK_COUNTER, ///< See: SLV_U64_TICK_COUNTER
|
||||
|
@@ -2043,6 +2043,7 @@ static SettingsContainer &GetSettingsTree()
|
||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[3]"));
|
||||
company->Add(new SettingEntry("company.advance_order_on_clone"));
|
||||
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
|
||||
company->Add(new SettingEntry("company.remain_if_next_order_same_station"));
|
||||
}
|
||||
|
||||
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
||||
|
@@ -768,6 +768,7 @@ struct CompanySettings {
|
||||
uint16 timetable_autofill_rounding; ///< round up timetable times to be a multiple of this number of ticks
|
||||
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
|
||||
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
|
||||
bool remain_if_next_order_same_station; ///< if the next order is for the same station, start loading/unloading again instead of leaving.
|
||||
|
||||
byte old_simulated_wormhole_signals; ///< no longer needs a setting: tunnel/bridge signal simulation spacing
|
||||
};
|
||||
|
@@ -925,7 +925,8 @@ static void ShipController(Ship *v)
|
||||
|
||||
bool may_reverse = ProcessOrders(v);
|
||||
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == station_id && IsDockingTile(gp.new_tile)) {
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == station_id &&
|
||||
IsDockingTile(gp.new_tile) && Company::Get(v->owner)->settings.remain_if_next_order_same_station) {
|
||||
Station *st = Station::Get(station_id);
|
||||
if (st->facilities & FACIL_DOCK && st->docking_station.Contains(gp.new_tile) && IsShipDestinationTile(gp.new_tile, station_id)) {
|
||||
v->last_station_visited = station_id;
|
||||
|
@@ -253,6 +253,15 @@ str = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP
|
||||
strhelp = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT
|
||||
patxname = ""copy_clone_add_to_group""
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = remain_if_next_order_same_station
|
||||
flags = SF_PER_COMPANY
|
||||
def = true
|
||||
str = STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION
|
||||
strhelp = STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION_HELPTEXT
|
||||
patxname = ""remain_if_next_order_same_station""
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = old_simulated_wormhole_signals
|
||||
|
@@ -6551,7 +6551,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
|
||||
|
||||
bool may_reverse = ProcessOrders(v);
|
||||
|
||||
if (IsRailStationTile(v->tile) && GetStationIndex(v->tile) == station_id) {
|
||||
if (IsRailStationTile(v->tile) && GetStationIndex(v->tile) == station_id && Company::Get(v->owner)->settings.remain_if_next_order_same_station) {
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == station_id &&
|
||||
!(v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) {
|
||||
v->last_station_visited = station_id;
|
||||
|
Reference in New Issue
Block a user