town_cmd.c
changeset 2493 f6b4300cc2b0
parent 2484 0e45d70ae908
child 2498 3ed05caa4449
--- a/town_cmd.c	Wed Oct 05 04:00:39 2005 +0000
+++ b/town_cmd.c	Wed Oct 05 07:20:26 2005 +0000
@@ -78,7 +78,7 @@
 
 static void TownDrawHouseLift(const TileInfo *ti)
 {
-	AddChildSpriteScreen(0x5A3, 0xE, 0x3C - (_m[ti->tile].m1 & 0x7F));
+	AddChildSpriteScreen(0x5A3, 0xE, 0x3C - GB(_m[ti->tile].m1, 0, 7));
 }
 
 typedef void TownDrawTileProc(const TileInfo *ti);
@@ -183,10 +183,10 @@
 		SB(_m[tile].m5, 0, 6, i);
 	}
 
-	a = _m[tile].m1 & 0x7F;
-	b = (_m[tile].m5&0x3F) * 6;
+	a = GB(_m[tile].m1, 0, 7);
+	b = GB(_m[tile].m5, 0, 6) * 6;
 	a += (a < b) ? 1 : -1;
-	_m[tile].m1 = (_m[tile].m1 & 0x80) | a;
+	SB(_m[tile].m1, 0, 7, a);
 
 	if (a == b) {
 		_m[tile].m1 &= 0x7F;
@@ -623,7 +623,7 @@
 
 		// Reached a tunnel? Then continue at the other side of it.
 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5& ~3) == 4) {
-			FindLengthOfTunnelResult flotr = FindLengthOfTunnel(tile, _m[tile].m5&3);
+			FindLengthOfTunnelResult flotr = FindLengthOfTunnel(tile, GB(_m[tile].m5, 0, 2));
 			*tile_ptr = flotr.tile;
 			return;
 		}