diff options
author | tron <tron@openttd.org> | 2005-07-20 15:29:28 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-07-20 15:29:28 +0000 |
commit | ac66e3e28f35c6939d3af68d1f0e26eb9b34e377 (patch) | |
tree | a82679a91beaee405777f0f3c5e3c45814f1ea5d /vehicle.c | |
parent | f432314fa907d4f3ee63537d399bad64a35033bd (diff) | |
download | openttd-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 'vehicle.c')
-rw-r--r-- | vehicle.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -612,8 +612,8 @@ void ViewportAddVehicles(DrawPixelInfo *dpi) static void ChimneySmokeInit(Vehicle *v) { uint32 r = Random(); - v->cur_image = SPR_CHIMNEY_SMOKE_0 + (r & 7); - v->progress = (r >> 16) & 7; + v->cur_image = SPR_CHIMNEY_SMOKE_0 + GB(r, 0, 3); + v->progress = GB(r, 16, 3); } static void ChimneySmokeTick(Vehicle *v) @@ -1299,8 +1299,8 @@ void CheckVehicleBreakdown(Vehicle *v) /* check if to break down */ if (_breakdown_chance[(uint)min(rel, 0xffff) >> 10] <= v->breakdown_chance) { - v->breakdown_ctr = (byte)(((r >> 16) & 0x3F) + 0x3F); - v->breakdown_delay = (byte)(((r >> 24) & 0x7F) | 0x80); + v->breakdown_ctr = GB(r, 16, 6) + 0x3F; + v->breakdown_delay = GB(r, 24, 7) + 0x80; v->breakdown_chance = 0; } } |