summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-21 06:31:02 +0000
committertron <tron@openttd.org>2005-07-21 06:31:02 +0000
commitd71788c40206fa35b792d34769fde7768b4456c1 (patch)
treedc5c9c74cec9bfa29f94932a20193cd902a80f15 /tunnelbridge_cmd.c
parent5c5840417e2f03514c51098f4786c6c1d6030b59 (diff)
downloadopenttd-d71788c40206fa35b792d34769fde7768b4456c1.tar.xz
(svn r2660) Get rid of some more shifting/anding/casting
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 76e801f7f..e72de08d3 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -377,8 +377,7 @@ not_valid_below:;
}
_m[ti.tile].m2 = (bridge_type << 4) | m5;
- _m[ti.tile].m3 &= 0xF;
- _m[ti.tile].m3 |= (byte)(railtype << 4);
+ SB(_m[ti.tile].m3, 4, 4, railtype);
MarkTileDirtyByTile(ti.tile);
}
@@ -549,8 +548,8 @@ int32 CmdBuildTunnel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (p1 != 0x200 && !ValParamRailtype(p1)) return CMD_ERROR;
- _build_tunnel_railtype = (byte)(p1 & 0xFF);
- _build_tunnel_bh = (byte)(p1 >> 8);
+ _build_tunnel_railtype = GB(p1, 0, 8);
+ _build_tunnel_bh = GB(p1, 8, 8);
_build_tunnel_endtile = 0;
excavated_tile = 0;
@@ -602,7 +601,7 @@ TileIndex CheckTunnelBusy(TileIndex tile, uint *length)
} while (
!IsTileType(tile, MP_TUNNELBRIDGE) ||
(_m[tile].m5 & 0xF0) != 0 ||
- (byte)(_m[tile].m5 ^ 2) != m5 ||
+ (_m[tile].m5 ^ 2) != m5 ||
GetTileZ(tile) != z
);
@@ -1015,9 +1014,9 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
bool ice = _m[ti->tile].m4 & 0x80;
// draw tunnel?
- if ( (byte)(ti->map5&0xF0) == 0) {
+ if ((ti->map5 & 0xF0) == 0) {
/* railway type */
- image = (_m[ti->tile].m3 & 0xF) * 8;
+ image = GB(_m[ti->tile].m3, 0, 4) * 8;
/* ice? */
if (ice)