diff options
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/pathfinder/follow_track.hpp | 2 | ||||
-rw-r--r-- | src/pathfinder/npf/npf.cpp | 2 | ||||
-rw-r--r-- | src/pathfinder/yapf/yapf_road.cpp | 6 | ||||
-rw-r--r-- | src/pathfinder/yapf/yapf_ship.cpp | 22 | ||||
-rw-r--r-- | src/ship_cmd.cpp | 9 |
6 files changed, 15 insertions, 30 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 6c482f053..5602094ee 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1200,8 +1200,8 @@ STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS_HELPTEXT :Steepness of a STR_CONFIG_SETTING_PERCENTAGE :{COMMA}% STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :Slope steepness for road vehicles: {STRING2} STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :Steepness of a sloped tile for a road vehicle. Higher values make it more difficult to climb a hill -STR_CONFIG_SETTING_FORBID_90_DEG :Forbid trains and ships from making 90° turns: {STRING2} -STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :90 degree turns occur when a horizontal track is directly followed by a vertical track piece on the adjacent tile, thus making the train turn by 90 degree when traversing the tile edge instead of the usual 45 degrees for other track combinations. This also applies to the turning radius of ships +STR_CONFIG_SETTING_FORBID_90_DEG :Forbid trains from making 90° turns: {STRING2} +STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :90 degree turns occur when a horizontal track is directly followed by a vertical track piece on the adjacent tile, thus making the train turn by 90 degree when traversing the tile edge instead of the usual 45 degrees for other track combinations. STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :Allow to join stations not directly adjacent: {STRING2} STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Allow adding parts to a station without directly touching the existing parts. Needs Ctrl+Click while placing the new parts STR_CONFIG_SETTING_INFLATION :Inflation: {STRING2} diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 9b4377248..acdff68a7 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -474,8 +474,6 @@ typedef CFollowTrackT<TRANSPORT_WATER, Ship, true > CFollowTrackWater; typedef CFollowTrackT<TRANSPORT_ROAD, RoadVehicle, true > CFollowTrackRoad; typedef CFollowTrackT<TRANSPORT_RAIL, Train, true > CFollowTrackRail; -typedef CFollowTrackT<TRANSPORT_WATER, Ship, false> CFollowTrackWaterNo90; -typedef CFollowTrackT<TRANSPORT_ROAD, RoadVehicle, false> CFollowTrackRoadNo90; typedef CFollowTrackT<TRANSPORT_RAIL, Train, false> CFollowTrackRailNo90; typedef CFollowTrackT<TRANSPORT_RAIL, Train, true, true > CFollowTrackFreeRail; diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 7d19d4ef1..d7722ae67 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -836,7 +836,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, Trackdir src_tr trackdirbits &= TrackdirReachesTrackdirs(src_trackdir); /* Filter out trackdirs that would make 90 deg turns for trains */ - if (_settings_game.pf.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir); + if (_settings_game.pf.forbid_90_deg && type == TRANSPORT_RAIL) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir); DEBUG(npf, 6, "After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits); diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 0240eb936..8da84444c 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -501,11 +501,11 @@ Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDi { /* default is YAPF type 2 */ typedef Trackdir (*PfnChooseRoadTrack)(const RoadVehicle*, TileIndex, DiagDirection, bool &path_found); - PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir, allow 90-deg + PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir /* check if non-default YAPF type should be used */ if (_settings_game.pf.yapf.disable_node_optimization) { - pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir, allow 90-deg + pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir } Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir, path_found); @@ -526,7 +526,7 @@ FindDepotData YapfRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_dist /* check if non-default YAPF type should be used */ if (_settings_game.pf.yapf.disable_node_optimization) { - pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg + pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir } return pfnFindNearestDepot(v, tile, trackdir, max_distance); diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index c6e484fea..5a8afc1b9 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -224,25 +224,21 @@ struct CYapfShip_TypesT typedef CYapfCostShipT<Types> PfCost; // cost provider }; -/* YAPF type 1 - uses TileIndex/Trackdir as Node key, allows 90-deg turns */ +/* YAPF type 1 - uses TileIndex/Trackdir as Node key */ struct CYapfShip1 : CYapfT<CYapfShip_TypesT<CYapfShip1, CFollowTrackWater , CShipNodeListTrackDir> > {}; -/* YAPF type 2 - uses TileIndex/DiagDirection as Node key, allows 90-deg turns */ +/* YAPF type 2 - uses TileIndex/DiagDirection as Node key */ struct CYapfShip2 : CYapfT<CYapfShip_TypesT<CYapfShip2, CFollowTrackWater , CShipNodeListExitDir > > {}; -/* YAPF type 3 - uses TileIndex/Trackdir as Node key, forbids 90-deg turns */ -struct CYapfShip3 : CYapfT<CYapfShip_TypesT<CYapfShip3, CFollowTrackWaterNo90, CShipNodeListTrackDir> > {}; /** Ship controller helper - path finder invoker */ Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, ShipPathCache &path_cache) { /* default is YAPF type 2 */ typedef Trackdir (*PfnChooseShipTrack)(const Ship*, TileIndex, DiagDirection, TrackBits, bool &path_found, ShipPathCache &path_cache); - PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir, allow 90-deg + PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir /* check if non-default YAPF type needed */ - if (_settings_game.pf.forbid_90_deg) { - pfnChooseShipTrack = &CYapfShip3::ChooseShipTrack; // Trackdir, forbid 90-deg - } else if (_settings_game.pf.yapf.disable_node_optimization) { - pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir, allow 90-deg + if (_settings_game.pf.yapf.disable_node_optimization) { + pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir } Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks, path_found, path_cache); @@ -256,13 +252,11 @@ bool YapfShipCheckReverse(const Ship *v) TileIndex tile = v->tile; typedef bool (*PfnCheckReverseShip)(const Ship*, TileIndex, Trackdir, Trackdir); - PfnCheckReverseShip pfnCheckReverseShip = CYapfShip2::CheckShipReverse; // default: ExitDir, allow 90-deg + PfnCheckReverseShip pfnCheckReverseShip = CYapfShip2::CheckShipReverse; // default: ExitDir /* check if non-default YAPF type needed */ - if (_settings_game.pf.forbid_90_deg) { - pfnCheckReverseShip = &CYapfShip3::CheckShipReverse; // Trackdir, forbid 90-deg - } else if (_settings_game.pf.yapf.disable_node_optimization) { - pfnCheckReverseShip = &CYapfShip1::CheckShipReverse; // Trackdir, allow 90-deg + if (_settings_game.pf.yapf.disable_node_optimization) { + pfnCheckReverseShip = &CYapfShip1::CheckShipReverse; // Trackdir } bool reverse = pfnCheckReverseShip(v, tile, td, td_rev); diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index c2ce5adc9..0f3f7b74d 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -474,14 +474,7 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr /* No destination or destination too far, don't invoke pathfinder. */ track = TrackBitsToTrack(v->state); if (!IsDiagonalTrack(track)) track = TrackToOppositeTrack(track); - if (!HasBit(tracks, track)) { - /* Can't continue in same direction so pick first available track. */ - if (_settings_game.pf.forbid_90_deg) { - tracks &= ~TrackCrossesTracks(TrackdirToTrack(v->GetVehicleTrackdir())); - if (tracks == TRACK_BIT_NONE) return INVALID_TRACK; - } - track = FindFirstTrack(tracks); - } + if (!HasBit(tracks, track)) track = FindFirstTrack(tracks); path_found = false; } else { /* Attempt to follow cached path. */ |