Add setting to control whether trains can crash with other companies'.
This commit is contained in:
@@ -1254,6 +1254,9 @@ STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Changing
|
|||||||
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :Infrastructure maintenance: {STRING2}
|
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :Infrastructure maintenance: {STRING2}
|
||||||
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :When enabled, infrastructure causes maintenance costs. The cost grows over-proportional with the network size, thus affecting bigger companies more than smaller ones
|
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :When enabled, infrastructure causes maintenance costs. The cost grows over-proportional with the network size, thus affecting bigger companies more than smaller ones
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY :Trains from different companies may not crash into each other: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY_HELPTEXT :This setting is primarily to prevent untrusted players deliberately causing crashes involving other companies' trains in multi-player rail infrastructure sharing games.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Airports never expire: {STRING2}
|
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Airports never expire: {STRING2}
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Enabling this setting makes each airport type stay available forever after its introduction
|
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Enabling this setting makes each airport type stay available forever after its introduction
|
||||||
|
|
||||||
|
@@ -1661,6 +1661,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
disasters->Add(new SettingEntry("difficulty.economy"));
|
disasters->Add(new SettingEntry("difficulty.economy"));
|
||||||
disasters->Add(new SettingEntry("difficulty.vehicle_breakdowns"));
|
disasters->Add(new SettingEntry("difficulty.vehicle_breakdowns"));
|
||||||
disasters->Add(new SettingEntry("vehicle.plane_crashes"));
|
disasters->Add(new SettingEntry("vehicle.plane_crashes"));
|
||||||
|
disasters->Add(new SettingEntry("vehicle.no_train_crash_other_company"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *genworld = main->Add(new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
|
SettingsPage *genworld = main->Add(new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
|
||||||
|
@@ -462,6 +462,7 @@ struct VehicleSettings {
|
|||||||
byte extend_vehicle_life; ///< extend vehicle life by this many years
|
byte extend_vehicle_life; ///< extend vehicle life by this many years
|
||||||
byte road_side; ///< the side of the road vehicles drive on
|
byte road_side; ///< the side of the road vehicles drive on
|
||||||
uint8 plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
|
uint8 plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
|
||||||
|
bool no_train_crash_other_company; ///< trains cannot crash with trains from other companies
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Settings related to the economy. */
|
/** Settings related to the economy. */
|
||||||
|
@@ -1142,6 +1142,15 @@ strhelp = STR_CONFIG_SETTING_PLANE_CRASHES_HELPTEXT
|
|||||||
strval = STR_CONFIG_SETTING_PLANE_CRASHES_NONE
|
strval = STR_CONFIG_SETTING_PLANE_CRASHES_NONE
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
|
[SDT_BOOL]
|
||||||
|
base = GameSettings
|
||||||
|
var = vehicle.no_train_crash_other_company
|
||||||
|
def = false
|
||||||
|
str = STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY
|
||||||
|
strhelp = STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY_HELPTEXT
|
||||||
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
|
||||||
|
patxname = ""infra_sharing.vehicle.no_train_crash_other_company""
|
||||||
|
|
||||||
; station.join_stations
|
; station.join_stations
|
||||||
[SDT_NULL]
|
[SDT_NULL]
|
||||||
length = 1
|
length = 1
|
||||||
|
@@ -3011,6 +3011,11 @@ static Vehicle *FindTrainCollideEnum(Vehicle *v, void *data)
|
|||||||
/* not a train or in depot */
|
/* not a train or in depot */
|
||||||
if (v->type != VEH_TRAIN || Train::From(v)->track == TRACK_BIT_DEPOT) return NULL;
|
if (v->type != VEH_TRAIN || Train::From(v)->track == TRACK_BIT_DEPOT) return NULL;
|
||||||
|
|
||||||
|
if (_settings_game.vehicle.no_train_crash_other_company) {
|
||||||
|
/* do not crash into trains of another company. */
|
||||||
|
if (v->owner != tcc->v->owner) return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* get first vehicle now to make most usual checks faster */
|
/* get first vehicle now to make most usual checks faster */
|
||||||
Train *coll = Train::From(v)->First();
|
Train *coll = Train::From(v)->First();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user