YAPF cost provider for route links. More...
Public Member Functions | |
bool | PfCalcCost (Node &n, const Follower *follow) |
Called by YAPF to calculate the cost from the origin to the given node. | |
Private Types | |
typedef Types::Tpf | Tpf |
The pathfinder class (derived from THIS class). | |
typedef Types::TrackFollower | Follower |
The route follower. | |
typedef Types::NodeList::Titem | Node |
This will be our node type. | |
Private Member Functions | |
FORCEINLINE Tpf & | Yapf () |
To access inherited path finder. | |
FORCEINLINE const Tpf & | Yapf () const |
FORCEINLINE bool | ValidLink (Node &n, const RouteLink *link, const RouteLink *parent) const |
Check if this is a valid connection. | |
FORCEINLINE int | RouteLinkCost (const RouteLink *link, const RouteLink *parent) const |
Cost of a single route link. | |
Static Private Attributes | |
static const int | PENALTY_DIVISOR = 16 |
Penalty factor divisor for fixed-point arithmetics. | |
static const int | LOCAL_PENALTY_FACTOR = 20 |
Penalty factor for source-local delivery. | |
static const int | RF_DISTANCE_FACTOR = 2 |
Vehicle modifier for "cheap" cargo packets. | |
static const int | RF_TIME_FACTOR = 3 |
Time modifier for "fast" cargo packets. |
YAPF cost provider for route links.
Definition at line 90 of file yapf_cargo.cpp.
bool CYapfCostRouteLinkT< Types >::PfCalcCost | ( | Node & | n, | |
const Follower * | follow | |||
) | [inline] |
Called by YAPF to calculate the cost from the origin to the given node.
Definition at line 167 of file yapf_cargo.cpp.
References SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), INVALID_ORDER, CYapfCostRouteLinkT< Types >::LOCAL_PENALTY_FACTOR, CYapfCostRouteLinkT< Types >::RouteLinkCost(), CYapfCostRouteLinkT< Types >::ValidLink(), and CYapfCostRouteLinkT< Types >::Yapf().
FORCEINLINE int CYapfCostRouteLinkT< Types >::RouteLinkCost | ( | const RouteLink * | link, | |
const RouteLink * | parent | |||
) | const [inline, private] |
Cost of a single route link.
Definition at line 128 of file yapf_cargo.cpp.
References _settings_game, GoodsEntry::cargo, StationCargoList::CountForNextHop(), DistanceManhattan(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_order_pool >::Get(), SpecializedStation< Station, false >::Get(), RouteLink::GetDestination(), RouteLink::GetDestOrderId(), RouteLink::GetOriginOrderId(), RouteLink::GetTravelTime(), RouteLink::GetVehicleType(), RouteLink::GetWaitTime(), Station::goods, HasBit(), lengthof, OUFB_UNLOAD, CYapfCostRouteLinkT< Types >::PENALTY_DIVISOR, GameSettings::pf, CYapfCostRouteLinkT< Types >::RF_DISTANCE_FACTOR, CYapfCostRouteLinkT< Types >::RF_TIME_FACTOR, RF_WANT_CHEAP, RF_WANT_FAST, YAPFSettings::route_mode_cost_factor, VEH_AIRCRAFT, BaseStation::xy, PathfinderSettings::yapf, and CYapfCostRouteLinkT< Types >::Yapf().
Referenced by CYapfCostRouteLinkT< Types >::PfCalcCost().
FORCEINLINE bool CYapfCostRouteLinkT< Types >::ValidLink | ( | Node & | n, | |
const RouteLink * | link, | |||
const RouteLink * | parent | |||
) | const [inline, private] |
Check if this is a valid connection.
Definition at line 105 of file yapf_cargo.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_order_pool >::Get(), RouteLink::GetDestOrderId(), RouteLink::GetOriginOrderId(), RouteLink::GetOwner(), INVALID_ORDER, INVALID_OWNER, OLFB_NO_LOAD, OUFB_NO_UNLOAD, OUFB_UNLOAD, and CYapfCostRouteLinkT< Types >::Yapf().
Referenced by CYapfCostRouteLinkT< Types >::PfCalcCost().
FORCEINLINE Tpf& CYapfCostRouteLinkT< Types >::Yapf | ( | ) | [inline, private] |
To access inherited path finder.
Definition at line 101 of file yapf_cargo.cpp.
Referenced by CYapfCostRouteLinkT< Types >::PfCalcCost(), CYapfCostRouteLinkT< Types >::RouteLinkCost(), and CYapfCostRouteLinkT< Types >::ValidLink().