Files @ r8680:3232a99af2b8
Branch filter:

Location: cpp/openttd-patchpack/source/src/tunnelbridge_map.h - annotation

frosch
(svn r12346) -Fix [FS#1748, FS#1825](r9874, r11872): Remove duplicated and inconsistent code wrt. autoreplace with rules in both vehicles' group and ALL_GROUP.
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8100:d1eb5523ede7
r8139:4fc34c1bc2fb
r8139:4fc34c1bc2fb
r8197:5f087672abf6
r8197:5f087672abf6
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8481:eb333f15ccd8
r8481:eb333f15ccd8
r8481:eb333f15ccd8
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8083:8cd2123a0c7c
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8197:5f087672abf6
r8083:8cd2123a0c7c
/* $Id$ */

/** @file tunnelbridge_map.h Functions that have tunnels and bridges in common */

#ifndef TUNNELBRIDGE_MAP_H
#define TUNNELBRIDGE_MAP_H

#include "direction_func.h"
#include "core/bitmath_func.hpp"
#include "tile_map.h"
#include "bridge_map.h"
#include "tunnel_map.h"


/**
 * Get the direction pointing to the other end.
 *
 * Tunnel: Get the direction facing into the tunnel
 * Bridge: Get the direction pointing onto the bridge
 * @param t The tile to analyze
 * @pre IsTileType(t, MP_TUNNELBRIDGE)
 * @return the above mentionned direction
 */
static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
{
	assert(IsTileType(t, MP_TUNNELBRIDGE));
	return (DiagDirection)GB(_m[t].m5, 0, 2);
}

/**
 * Tunnel: Get the transport type of the tunnel (road or rail)
 * Bridge: Get the transport type of the bridge's ramp
 * @param t The tile to analyze
 * @pre IsTileType(t, MP_TUNNELBRIDGE)
 * @return the transport type in the tunnel/bridge
 */
static inline TransportType GetTunnelBridgeTransportType(TileIndex t)
{
	assert(IsTileType(t, MP_TUNNELBRIDGE));
	return (TransportType)GB(_m[t].m5, 2, 2);
}

/**
 * Tunnel: Is this tunnel entrance in a snowy or desert area?
 * Bridge: Does the bridge ramp lie in a snow or desert area?
 * @param t The tile to analyze
 * @pre IsTileType(t, MP_TUNNELBRIDGE)
 * @return true if and only if the tile is in a snowy/desert area
 */
static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
{
	assert(IsTileType(t, MP_TUNNELBRIDGE));
	return HasBit(_m[t].m4, 7);
}

/**
 * Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there.
 * Bridge: Sets whether the bridge ramp lies in a snow or desert area.
 * @param t the tunnel entrance / bridge ramp tile
 * @param snow_or_desert is the entrance/ramp in snow or desert (true), when
 *                       not in snow and not in desert false
 * @pre IsTileType(t, MP_TUNNELBRIDGE)
 */
static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
{
	assert(IsTileType(t, MP_TUNNELBRIDGE));
	SB(_m[t].m4, 7, 1, snow_or_desert);
}

/**
 * Determines type of the wormhole and returns its other end
 * @param t one end
 * @pre IsTileType(t, MP_TUNNELBRIDGE)
 * @return other end
 */
static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
{
	assert(IsTileType(t, MP_TUNNELBRIDGE));
	return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
}

#endif /* TUNNELBRIDGE_MAP_H */