Files @ r5857:4b1b2f7c805d
Branch filter:

Location: cpp/openttd-patchpack/source/src/yapf/yapf_costbase.hpp

miham
(svn r8431) -Update: WebTranslator2 update to 2007-01-27 19:34:37
catalan - 4 fixed by arnaullv (4)
danish - 4 fixed, 2 changed by MiR (6)
dutch - 4 fixed by habell (4)
french - 4 fixed by glx (4)
german - 4 fixed by Neonox (4)
hungarian - 4 fixed by miham (4)
korean - 4 fixed, 4 changed by Nios (4), leejaeuk5 (4)
lithuanian - 2 changed by Domas (2)
polish - 4 fixed by meush (4)
portuguese - 4 fixed by izhirahider (4)
simplified_chinese - 4 fixed by Fishingsnow (4)
slovenian - 4 fixed, 410 changed by Necrolyte (414)
ukrainian - 34 fixed, 49 changed by mad (79), znikoz (4)
/* $Id$ */

#ifndef  YAPF_COSTBASE_HPP
#define  YAPF_COSTBASE_HPP

struct CYapfCostBase {
	static const TrackdirBits   c_upwards_slopes[16];

	FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td)
	{
		if (IsDiagonalTrackdir(td)) {
			if (IsBridgeTile(tile)) {
				// it is bridge ramp, check if we are entering the bridge
				if (GetBridgeRampDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
				// we are entering the bridge
				// if the tile slope is downwards, then bridge ramp has not upward slope
				uint tile_slope = GetTileSlope(tile, NULL) & 0x0F;
				if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(ReverseTrackdir(td))) != 0) return false; // tile under ramp goes down, no penalty
				// tile under ramp isn't going down, so ramp must go up
				return true;
			} else {
				// not bridge ramp
				if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
				uint tile_slope = GetTileSlope(tile, NULL) & 0x0F;
				if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(td)) != 0) return true; // slopes uphill => apply penalty
			}
		}
		return false;
	}
};

struct CostRailSettings {
	// look-ahead signal penalty
};


#endif /* YAPF_COSTBASE_HPP */