|
OpenTTD Source 20260421-master-gc2fbc6fdeb
|
Data Structures | |
| struct | TILE |
| Structure used inside PfCalcCost() to keep basic tile information. More... | |
Public Types | |
| typedef Types::Tpf | Tpf |
| the pathfinder class (derived from THIS class) | |
| typedef Types::TrackFollower | TrackFollower |
| typedef Types::NodeList::Item | Node |
| this will be our node type | |
| typedef Node::Key | Key |
| key to hash tables | |
| typedef Node::CachedData | CachedData |
Public Member Functions | |
| void | SetTreatFirstRedTwoWaySignalAsEOL (bool enabled) |
| Sets whether the first two-way signal should be treated as a dead end. | |
| bool | TreatFirstRedTwoWaySignalAsEOL () |
| Returns whether the first two-way signal should be treated as a dead end. | |
| int | SlopeCost (TileIndex tile, Trackdir td) |
| int | CurveCost (Trackdir td1, Trackdir td2) |
| int | SwitchCost (TileIndex tile1, TileIndex tile2, DiagDirection exitdir) |
| int | OneTileCost (TileIndex tile, Trackdir trackdir) |
| Return one tile cost (base cost + level crossing penalty). | |
| bool | IsAnyStationTileReserved (TileIndex tile, Trackdir trackdir, int distance) |
| Check for a reserved station platform. | |
| int | ReservationCost (Node &n, TileIndex tile, Trackdir trackdir, int skipped) |
| Calculate the cost for reserved tiles, including skipped ones. | |
| int | SignalCost (Node &n, TileIndex tile, Trackdir trackdir) |
| int | PlatformLengthPenalty (int platform_length) |
| void | SetMaxCost (int max_cost) |
| bool | PfCalcCost (Node &n, const TrackFollower *follower) |
| Called by YAPF to calculate the cost from the origin to the given node. | |
| bool | CanUseGlobalCache (Node &n) const |
| void | ConnectNodeToCachedData (Node &n, CachedData &ci) |
| void | DisableCache (bool disable) |
Data Fields | |
| bool | stopped_on_first_two_way_signal = false |
Protected Member Functions | |
| Tpf & | Yapf () |
| Access the inherited path finder. | |
Protected Attributes | |
| int | max_cost = 0 |
| bool | disable_cache = false |
| std::vector< int > | sig_look_ahead_costs = {} |
| bool | treat_first_red_two_way_signal_as_eol = false |
Static Protected Attributes | |
| static constexpr int | MAX_SEGMENT_COST = 10000 |
Additional Inherited Members | |
| Static Public Member Functions inherited from CYapfCostBase | |
| static bool | stSlopeCost (TileIndex tile, Trackdir td) |
| Does the given track direction on the given tile yield an uphill penalty? | |
Definition at line 21 of file yapf_costrail.hpp.
| typedef Node::CachedData CYapfCostRailT< Types >::CachedData |
Definition at line 27 of file yapf_costrail.hpp.
| typedef Node::Key CYapfCostRailT< Types >::Key |
key to hash tables
Definition at line 26 of file yapf_costrail.hpp.
| typedef Types::NodeList::Item CYapfCostRailT< Types >::Node |
this will be our node type
Definition at line 25 of file yapf_costrail.hpp.
| typedef Types::Tpf CYapfCostRailT< Types >::Tpf |
the pathfinder class (derived from THIS class)
Definition at line 23 of file yapf_costrail.hpp.
| typedef Types::TrackFollower CYapfCostRailT< Types >::TrackFollower |
Definition at line 24 of file yapf_costrail.hpp.
|
inlineprotected |
Definition at line 59 of file yapf_costrail.hpp.
|
inline |
Definition at line 636 of file yapf_costrail.hpp.
|
inline |
Definition at line 643 of file yapf_costrail.hpp.
|
inline |
Definition at line 103 of file yapf_costrail.hpp.
|
inline |
Definition at line 652 of file yapf_costrail.hpp.
|
inline |
Check for a reserved station platform.
| tile | The tile to check. |
| trackdir | The direction to check in. |
| distance | The number of tiles to check. |
true iff there is any reserved tile in the given direction for the given distance. Definition at line 166 of file yapf_costrail.hpp.
References HasStationReservation(), ReverseTrackdir(), TileOffsByDiagDir(), and TrackdirToExitdir().
Referenced by ReservationCost().
|
inline |
Return one tile cost (base cost + level crossing penalty).
| tile | The tile to consider. |
| trackdir | The direction of travel. |
Definition at line 135 of file yapf_costrail.hpp.
References GetTileType(), IsDiagonalTrackdir(), IsLevelCrossing(), Road, Yapf(), YAPF_TILE_CORNER_LENGTH, and YAPF_TILE_LENGTH.
|
inline |
Called by YAPF to calculate the cost from the origin to the given node.
Calculates only the cost of given node, adds it to the parent node cost and stores the result into Node::cost member.
| n | The node to consider. |
| follower | The track follower to the next node. |
true iff the costs could be calculated. Definition at line 294 of file yapf_costrail.hpp.
References _settings_game, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), ChoiceFollows, Vehicle::current_order, DeadEnd, Depot, ESRF_ABORT_PF_MASK, ESRF_CACHED_MASK, ESRF_POSSIBLE_TARGET, FindFirstBit(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::Follow(), SpecializedStation< Waypoint, true >::Get(), BaseStation::GetByTile(), Order::GetDestination(), Train::GetDisplayMaxSpeed(), Order::GetMaxSpeed(), BaseStation::GetPlatformLength(), GetSignalStateByTrackdir(), GetSignalType(), GetStationIndex(), HasOnewaySignalBlockingTrackdir(), HasSignalOnTrackdir(), HasTrackdir(), InfiniteLoop, INVALID_TILE, INVALID_TRACKDIR, IsPbsSignal(), IsRailDepot(), IsRailDepotTile(), IsRailWaypoint(), IsSafeWaitingPosition(), IsTileType(), Order::IsType(), IsWaitingPositionFree(), KillFirstBit(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::new_td_bits, CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::new_tile, PathTooLong, RailType, Railway, RemoveFirstTrackdir(), ReverseDiagDir(), ReverseTrackdir(), SafeTile, SegmentTooLong, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SIGNAL_STATE_RED, SIGTYPE_EXIT, SIGTYPE_PBS_ONEWAY, Station, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TRACKDIR_BIT_NONE, TrackdirToExitdir(), TrackdirToTrack(), Waypoint, Yapf(), and YAPF_TILE_LENGTH.
|
inline |
Definition at line 269 of file yapf_costrail.hpp.
|
inline |
Calculate the cost for reserved tiles, including skipped ones.
| n | The current node. |
| tile | The start tile to look at. |
| trackdir | The chosen track direction at the tile. |
| skipped | The number of tiles the path follower skipped. |
Definition at line 183 of file yapf_costrail.hpp.
References GetReservedTrackbits(), IsAnyStationTileReserved(), IsDiagonalTrackdir(), IsPbsSignal(), IsRailStationTile(), TrackdirToTrack(), TrackOverlapsTracks(), Yapf(), YAPF_TILE_CORNER_LENGTH, and YAPF_TILE_LENGTH.
|
inline |
Definition at line 288 of file yapf_costrail.hpp.
|
inline |
Sets whether the first two-way signal should be treated as a dead end.
| enabled | Whether to treat them as dead ends. |
Definition at line 83 of file yapf_costrail.hpp.
|
inline |
Definition at line 198 of file yapf_costrail.hpp.
|
inline |
Definition at line 97 of file yapf_costrail.hpp.
|
inline |
Definition at line 119 of file yapf_costrail.hpp.
|
inline |
Returns whether the first two-way signal should be treated as a dead end.
true iff the rail_firstred_twoway_eol setting is enabled, and it is enabled for this instance. Definition at line 92 of file yapf_costrail.hpp.
References Yapf().
|
inlineprotected |
Access the inherited path finder.
Definition at line 73 of file yapf_costrail.hpp.
Referenced by OneTileCost(), PfCalcCost(), ReservationCost(), and TreatFirstRedTwoWaySignalAsEOL().
|
protected |
Definition at line 49 of file yapf_costrail.hpp.
|
protected |
Definition at line 48 of file yapf_costrail.hpp.
|
staticconstexprprotected |
Definition at line 57 of file yapf_costrail.hpp.
|
protected |
Definition at line 50 of file yapf_costrail.hpp.
| bool CYapfCostRailT< Types >::stopped_on_first_two_way_signal = false |
Definition at line 54 of file yapf_costrail.hpp.
|
protected |
Definition at line 51 of file yapf_costrail.hpp.