yapf_costbase.hpp

00001 /* $Id: yapf_costbase.hpp 12313 2008-02-28 17:34:34Z frosch $ */
00002 
00003 #ifndef  YAPF_COSTBASE_HPP
00004 #define  YAPF_COSTBASE_HPP
00005 
00006 struct CYapfCostBase {
00007   FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td)
00008   {
00009     if (IsDiagonalTrackdir(td)) {
00010       if (IsBridgeTile(tile)) {
00011         // it is bridge ramp, check if we are entering the bridge
00012         if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
00013         // we are entering the bridge
00014         Slope tile_slope = GetTileSlope(tile, NULL);
00015         Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
00016         return !HasBridgeFlatRamp(tile_slope, axis);
00017       } else {
00018         // not bridge ramp
00019         if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
00020         Slope tile_slope = GetTileSlope(tile, NULL);
00021         return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
00022       }
00023     }
00024     return false;
00025   }
00026 };
00027 
00028 struct CostRailSettings {
00029   // look-ahead signal penalty
00030 };
00031 
00032 
00033 #endif /* YAPF_COSTBASE_HPP */

Generated on Mon Sep 22 20:34:20 2008 for openttd by  doxygen 1.5.6