summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-20 15:29:28 +0000
committertron <tron@openttd.org>2005-07-20 15:29:28 +0000
commitac66e3e28f35c6939d3af68d1f0e26eb9b34e377 (patch)
treea82679a91beaee405777f0f3c5e3c45814f1ea5d /town_cmd.c
parentf432314fa907d4f3ee63537d399bad64a35033bd (diff)
downloadopenttd-ac66e3e28f35c6939d3af68d1f0e26eb9b34e377.tar.xz
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/town_cmd.c b/town_cmd.c
index 56413df66..1e1daf6fe 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -769,9 +769,10 @@ static int GrowTownAtRoad(Town *t, TileIndex tile)
static int GenRandomRoadBits(void)
{
uint32 r = Random();
- int a = r&3, b = (r >> 8) & 3;
+ uint a = GB(r, 0, 2);
+ uint b = GB(r, 8, 2);
if (a == b) b ^= 2;
- return (1<<a)+(1<<b);
+ return (1 << a) + (1 << b);
}
// Grow the town
@@ -1307,7 +1308,7 @@ static void DoBuildTownHouse(Town *t, TileIndex tile)
ChangePopulation(t, _housetype_population[house]);
// Initial value for map5.
- m5 = (r >> 16) & 0x3F;
+ m5 = GB(r, 16, 6);
}
assert(IsTileType(tile, MP_CLEAR));