2006-05-27 18:12:16 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef YAPF_COSTBASE_HPP
|
|
|
|
#define YAPF_COSTBASE_HPP
|
|
|
|
|
|
|
|
struct CYapfCostBase {
|
|
|
|
FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td)
|
|
|
|
{
|
2006-11-21 17:24:13 +01:00
|
|
|
if (IsDiagonalTrackdir(td)) {
|
2006-12-27 13:38:02 +01:00
|
|
|
if (IsBridgeTile(tile)) {
|
2006-11-21 17:24:13 +01:00
|
|
|
// it is bridge ramp, check if we are entering the bridge
|
2007-12-16 16:38:51 +01:00
|
|
|
if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
|
2006-11-21 17:24:13 +01:00
|
|
|
// we are entering the bridge
|
2008-01-22 17:08:17 +01:00
|
|
|
Slope tile_slope = GetTileSlope(tile, NULL);
|
|
|
|
Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
|
|
|
|
return !HasBridgeFlatRamp(tile_slope, axis);
|
2006-11-21 17:24:13 +01:00
|
|
|
} else {
|
|
|
|
// not bridge ramp
|
|
|
|
if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
|
2008-02-28 18:34:34 +01:00
|
|
|
Slope tile_slope = GetTileSlope(tile, NULL);
|
|
|
|
return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
|
2006-05-27 18:12:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CostRailSettings {
|
|
|
|
// look-ahead signal penalty
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* YAPF_COSTBASE_HPP */
|