yapf_costbase.hpp

Go to the documentation of this file.
00001 /* $Id: yapf_costbase.hpp 17248 2009-08-21 20:21:05Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef  YAPF_COSTBASE_HPP
00013 #define  YAPF_COSTBASE_HPP
00014 
00015 struct CYapfCostBase {
00016   FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td)
00017   {
00018     if (IsDiagonalTrackdir(td)) {
00019       if (IsBridgeTile(tile)) {
00020         /* it is bridge ramp, check if we are entering the bridge */
00021         if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are leaving it, no penalty
00022         /* we are entering the bridge */
00023         Slope tile_slope = GetTileSlope(tile, NULL);
00024         Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
00025         return !HasBridgeFlatRamp(tile_slope, axis);
00026       } else {
00027         /* not bridge ramp */
00028         if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
00029         Slope tile_slope = GetTileSlope(tile, NULL);
00030         return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
00031       }
00032     }
00033     return false;
00034   }
00035 };
00036 
00037 struct CostRailSettings {
00038   /* look-ahead signal penalty */
00039 };
00040 
00041 
00042 #endif /* YAPF_COSTBASE_HPP */

Generated on Sat Jun 19 17:14:51 2010 for OpenTTD by  doxygen 1.6.1