summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-30 09:29:20 +0000
committertron <tron@openttd.org>2005-07-30 09:29:20 +0000
commit2f1d530bb56923339253c662f7c271bbd0b4611c (patch)
tree4e9f7fae006fcf7f0433f1e421bad805c1c2013f /town_cmd.c
parentc7ddb6f82451615d021e174a72e321c4ac0ae46c (diff)
downloadopenttd-2f1d530bb56923339253c662f7c271bbd0b4611c.tar.xz
(svn r2758) Add the AB() macro to add a value to a bit range and use it in a few places, also make use of GB and SB nearby
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/town_cmd.c b/town_cmd.c
index 34be73deb..6285b495b 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -180,7 +180,7 @@ static void AnimateTile_Town(TileIndex tile)
i = (Random()&7) - 1;
} while (i < 0 || i == 1 || i*6==old);
- _m[tile].m5 = (_m[tile].m5 & ~0x3F) | i;
+ SB(_m[tile].m5, 0, 6, i);
}
a = _m[tile].owner&0x7F;
@@ -255,18 +255,12 @@ uint32 GetWorldPopulation(void)
static void MakeSingleHouseBigger(TileIndex tile)
{
- byte b;
-
assert(IsTileType(tile, MP_HOUSE));
- b = _m[tile].m5;
- if (b & 0x80)
- return;
-
- _m[tile].m5 = (b & 0xC0) | ((b+1)&7);
+ if (_m[tile].m5 & 0x80) return;
- if ((_m[tile].m5&7) != 0)
- return;
+ AB(_m[tile].m5, 0, 3, 1);
+ if (GB(_m[tile].m5, 0, 3) != 0) return;
_m[tile].m3 = _m[tile].m3 + 0x40;