Add a dedicated setting to enable ship collision avoidance.
This commit is contained in:
@@ -1253,6 +1253,8 @@ STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :Allow construct
|
|||||||
STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Changing this setting is not possible when there are vehicles
|
STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Changing this setting is not possible when there are vehicles
|
||||||
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_SHIP_COLLISION_AVOIDANCE :Ships avoid collisions: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE_HELPTEXT :When enabled, ships try to avoid passing through each other. Requires 90° turns to be forbidden.
|
||||||
|
|
||||||
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
|
||||||
|
@@ -1612,6 +1612,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
physics->Add(new SettingEntry("vehicle.roadveh_slope_steepness"));
|
physics->Add(new SettingEntry("vehicle.roadveh_slope_steepness"));
|
||||||
physics->Add(new SettingEntry("vehicle.smoke_amount"));
|
physics->Add(new SettingEntry("vehicle.smoke_amount"));
|
||||||
physics->Add(new SettingEntry("vehicle.plane_speed"));
|
physics->Add(new SettingEntry("vehicle.plane_speed"));
|
||||||
|
physics->Add(new SettingEntry("vehicle.ship_collision_avoidance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *routing = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
|
SettingsPage *routing = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
|
||||||
|
@@ -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 ship_collision_avoidance; ///< ships try to avoid colliding with each other
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Settings related to the economy. */
|
/** Settings related to the economy. */
|
||||||
|
@@ -620,7 +620,7 @@ static void ShipController(Ship *v)
|
|||||||
if (track == INVALID_TRACK) goto reverse_direction;
|
if (track == INVALID_TRACK) goto reverse_direction;
|
||||||
|
|
||||||
/* Try to avoid collision and keep distance between each other. */
|
/* Try to avoid collision and keep distance between each other. */
|
||||||
if (_settings_game.pf.forbid_90_deg && DistanceManhattan(v->dest_tile, gp.new_tile) > 3) {
|
if (_settings_game.pf.forbid_90_deg && _settings_game.vehicle.ship_collision_avoidance && DistanceManhattan(v->dest_tile, gp.new_tile) > 3) {
|
||||||
if (HasVehicleOnPos(gp.new_tile, NULL, &FindShipOnTile) ||
|
if (HasVehicleOnPos(gp.new_tile, NULL, &FindShipOnTile) ||
|
||||||
HasVehicleOnPos(TileAddByDiagDir(gp.new_tile, _diagdir_to_next_tile[track][diagdir]), NULL, &FindShipOnTile)) {
|
HasVehicleOnPos(TileAddByDiagDir(gp.new_tile, _diagdir_to_next_tile[track][diagdir]), NULL, &FindShipOnTile)) {
|
||||||
|
|
||||||
|
@@ -1138,6 +1138,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.ship_collision_avoidance
|
||||||
|
def = true
|
||||||
|
str = STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE
|
||||||
|
strhelp = STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE_HELPTEXT
|
||||||
|
patxname = ""ship_collision_avoidance.vehicle.ship_collision_avoidance""
|
||||||
|
cat = SC_BASIC
|
||||||
|
|
||||||
; station.join_stations
|
; station.join_stations
|
||||||
[SDT_NULL]
|
[SDT_NULL]
|
||||||
length = 1
|
length = 1
|
||||||
|
Reference in New Issue
Block a user