(svn r7598) [cbh] - Codechange: Remove the functions IsTunnel() and IsBridge() as they are no longer needed.
--- a/bridge_map.c Thu Dec 28 17:21:22 2006 +0000
+++ b/bridge_map.c Thu Dec 28 17:30:06 2006 +0000
@@ -13,7 +13,7 @@
dir = ReverseDiagDir(dir);
do {
tile += delta;
- } while (!IsBridge(tile) || GetBridgeRampDirection(tile) != dir);
+ } while (!IsBridgeTile(tile) || GetBridgeRampDirection(tile) != dir);
return tile;
}
--- a/bridge_map.h Thu Dec 28 17:21:22 2006 +0000
+++ b/bridge_map.h Thu Dec 28 17:30:06 2006 +0000
@@ -14,25 +14,11 @@
void DrawBridgeMiddle(const TileInfo* ti); // XXX
-static inline bool IsBridge(TileIndex t)
+static inline bool IsBridgeTile(TileIndex t)
{
-#if 0
- assert(IsTileType(t, MP_TUNNELBRIDGE));
- return HASBIT(_m[t].m5, 7);
-#endif
return IsTileType(t, MP_STREET_BRIDGE) || IsTileType(t, MP_RAILWAY_BRIDGE);
}
-#define IsBridgeTile(t) IsBridge(t)
-
-#if 0
-static inline bool IsBridgeTile(TileIndex t)
-{
- return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
-}
-#endif
-
-
static inline bool MayHaveBridgeAbove(TileIndex t)
{
return
--- a/train_cmd.c Thu Dec 28 17:21:22 2006 +0000
+++ b/train_cmd.c Thu Dec 28 17:30:06 2006 +0000
@@ -3408,7 +3408,7 @@
if (IsTileType(tile, MP_TUNNEL) || IsTileType(tile, MP_RAILWAY_BRIDGE)) {
DiagDirection dir;
- dir = IsTunnel(tile) ? GetTunnelDirection(tile) : GetBridgeRampDirection(tile);
+ dir = IsTunnelTile(tile) ? GetTunnelDirection(tile) : GetBridgeRampDirection(tile);
if (DiagDirToDir(dir) == v->direction) return true;
}
--- a/tunnel_map.h Thu Dec 28 17:21:22 2006 +0000
+++ b/tunnel_map.h Thu Dec 28 17:30:06 2006 +0000
@@ -8,25 +8,11 @@
#include "map.h"
#include "rail.h"
-
-static inline bool IsTunnel(TileIndex t)
+static inline bool IsTunnelTile(TileIndex t)
{
-#if 0
- assert(IsTileType(t, MP_TUNNELBRIDGE));
- return !HASBIT(_m[t].m5, 7);
-#endif
return IsTileType(t, MP_TUNNEL);
}
-#define IsTunnelTile(t) IsTunnel(t)
-#if 0
-static inline bool IsTunnelTile(TileIndex t)
-{
- return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
-}
-#endif
-
-
static inline DiagDirection GetTunnelDirection(TileIndex t)
{
assert(IsTunnelTile(t));
--- a/tunnelbridge_cmd.c Thu Dec 28 17:21:22 2006 +0000
+++ b/tunnelbridge_cmd.c Thu Dec 28 17:30:06 2006 +0000
@@ -643,10 +643,10 @@
static int32 ClearTile_TunnelBridge(TileIndex tile, byte flags)
{
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST);
return DoClearTunnel(tile, flags);
- } else if (IsBridge(tile)) { // XXX Is this necessary?
+ } else if (IsBridgeTile(tile)) { // XXX Is this necessary?
if (flags & DC_AUTO) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
return DoClearBridge(tile, flags);
}
@@ -658,7 +658,7 @@
{
TileIndex endtile;
- if (IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) {
+ if (IsTunnelTile(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) {
uint length;
if (!CheckTileOwnership(tile)) return CMD_ERROR;
@@ -683,7 +683,7 @@
YapfNotifyTrackLayoutChange(endtile, track);
}
return (length + 1) * (_price.build_rail >> 1);
- } else if (IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
+ } else if (IsBridgeTile(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
if (!CheckTileOwnership(tile)) return CMD_ERROR;
@@ -803,7 +803,7 @@
uint32 image;
bool ice = _m[ti->tile].m4 & 0x80;
- if (IsTunnel(ti->tile)) {
+ if (IsTunnelTile(ti->tile)) {
if (GetTunnelTransportType(ti->tile) == TRANSPORT_RAIL) {
image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.tunnel;
} else {
@@ -818,7 +818,7 @@
AddSortableSpriteToDraw(image+1, ti->x + TILE_SIZE - 1, ti->y + TILE_SIZE - 1, 1, 1, 8, (byte)ti->z);
DrawBridgeMiddle(ti);
- } else if (IsBridge(ti->tile)) { // XXX is this necessary?
+ } else if (IsBridgeTile(ti->tile)) { // XXX is this necessary?
int base_offset;
if (GetBridgeTransportType(ti->tile) == TRANSPORT_RAIL) {
@@ -996,7 +996,7 @@
x &= 0xF;
y &= 0xF;
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
uint pos = (DiagDirToAxis(GetTunnelDirection(tile)) == AXIS_X ? y : x);
// In the tunnel entrance?
@@ -1040,7 +1040,7 @@
static Slope GetSlopeTileh_TunnelBridge(TileIndex tile, Slope tileh)
{
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
return tileh;
} else {
if (HASBIT(BRIDGE_NO_FOUNDATION, tileh)) {
@@ -1095,7 +1095,7 @@
static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
{
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
td->str = (GetTunnelTransportType(tile) == TRANSPORT_RAIL) ?
STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL;
} else {
@@ -1137,7 +1137,7 @@
static uint32 GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode)
{
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
if (GetTunnelTransportType(tile) != mode) return 0;
return AxisToTrackBits(DiagDirToAxis(GetTunnelDirection(tile))) * 0x101;
} else {
@@ -1177,7 +1177,7 @@
if (myabs(z) > 2) return 8;
- if (IsTunnel(tile)) {
+ if (IsTunnelTile(tile)) {
byte fc;
DiagDirection dir;
DiagDirection vdir;
@@ -1242,7 +1242,7 @@
return 4;
}
}
- } else if (IsBridge(tile)) { // XXX is this necessary?
+ } else if (IsBridgeTile(tile)) { // XXX is this necessary?
DiagDirection dir;
if (v->type == VEH_Road || (v->type == VEH_Train && IsFrontEngine(v))) {