(svn r11760) -Codechange: unify the way how other end of a tunnel/bridge is determined at some places

-Fix: adding road/tram to tram/road bridge was cheaper by one tile
This commit is contained in:
smatz
2008-01-04 19:45:29 +00:00
parent aefb86d7fe
commit f02cf9281b
6 changed files with 27 additions and 21 deletions

View File

@@ -8,6 +8,8 @@
#include "direction_func.h"
#include "core/bitmath_func.hpp"
#include "tile_map.h"
#include "bridge_map.h"
#include "tunnel_map.h"
/**
@@ -63,4 +65,16 @@ static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
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 */