Add a dedicated setting to enable ship collision avoidance.

pull/6/merge
Jonathan G Rennison 8 years ago
parent c74a8ad557
commit b00b1125be

@ -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_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_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_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.smoke_amount"));
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));

@ -462,6 +462,7 @@ struct VehicleSettings {
byte extend_vehicle_life; ///< extend vehicle life by this many years
byte road_side; ///< the side of the road vehicles drive on
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. */

@ -620,7 +620,7 @@ static void ShipController(Ship *v)
if (track == INVALID_TRACK) goto reverse_direction;
/* 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) ||
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
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
[SDT_NULL]
length = 1

Loading…
Cancel
Save