yapf_costbase.hpp

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

Generated on Sun Mar 15 22:49:52 2009 for openttd by  doxygen 1.5.6