KUDr@3900: /* $Id$ */ KUDr@3900: KUDr@3900: #ifndef YAPF_COSTBASE_HPP KUDr@3900: #define YAPF_COSTBASE_HPP KUDr@3900: KUDr@3900: struct CYapfCostBase { KUDr@3900: static const TrackdirBits c_upwards_slopes[16]; KUDr@3900: KUDr@3900: FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td) KUDr@3900: { KUDr@5139: if (IsDiagonalTrackdir(td)) { celestar@5385: if (IsBridgeTile(tile)) { KUDr@5139: // it is bridge ramp, check if we are entering the bridge KUDr@5139: if (GetBridgeRampDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty KUDr@5139: // we are entering the bridge KUDr@5139: // if the tile slope is downwards, then bridge ramp has not upward slope KUDr@5139: uint tile_slope = GetTileSlope(tile, NULL) & 0x0F; KUDr@5139: if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(ReverseTrackdir(td))) != 0) return false; // tile under ramp goes down, no penalty KUDr@5139: // tile under ramp isn't going down, so ramp must go up KUDr@3900: return true; KUDr@5139: } else { KUDr@5139: // not bridge ramp KUDr@5139: if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope KUDr@5139: uint tile_slope = GetTileSlope(tile, NULL) & 0x0F; KUDr@5139: if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(td)) != 0) return true; // slopes uphill => apply penalty KUDr@3900: } KUDr@3900: } KUDr@3900: return false; KUDr@3900: } KUDr@3900: }; KUDr@3900: KUDr@3900: struct CostRailSettings { KUDr@3900: // look-ahead signal penalty KUDr@3900: }; KUDr@3900: KUDr@3900: KUDr@3900: #endif /* YAPF_COSTBASE_HPP */