summaryrefslogtreecommitdiff
path: root/disaster_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
commitf09638ad3d3eaf3574086e351a56bf5c14159894 (patch)
treea82679a91beaee405777f0f3c5e3c45814f1ea5d /disaster_cmd.c
parentf3645d73073e262d9dba2f4d69a9848be435b7df (diff)
downloadopenttd-f09638ad3d3eaf3574086e351a56bf5c14159894.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 'disaster_cmd.c')
-rw-r--r--disaster_cmd.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index 90e005df5..a0e22b7f2 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -226,9 +226,9 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
uint32 r = Random();
CreateEffectVehicleRel(v,
- -7 + (r&0xF),
- -7 + (r>>4&0xF),
- 5 + (r>>8&0x7),
+ GB(r, 0, 4) - 7,
+ GB(r, 4, 4) - 7,
+ GB(r, 8, 3) + 5,
EV_EXPLOSION_SMALL);
}
} else if (v->age == 350) {
@@ -364,9 +364,9 @@ static void DisasterTick_2(Vehicle *v)
uint32 r = Random();
CreateEffectVehicleAbove(
- x + (r & 0x3F),
- y + (r >> 6 & 0x3F),
- (r >> 12 & 0xF),
+ GB(r, 0, 6) + x,
+ GB(r, 6, 6) + y,
+ GB(r, 12, 4),
EV_EXPLOSION_SMALL);
if (++v->age >= 55)
@@ -435,9 +435,9 @@ static void DisasterTick_3(Vehicle *v)
uint32 r = Random();
CreateEffectVehicleAbove(
- x + (r & 0x3F),
- y + (r >> 6 & 0x3F),
- (r >> 12 & 0xF),
+ GB(r, 0, 6) + x,
+ GB(r, 6, 6) + y,
+ GB(r, 12, 4),
EV_EXPLOSION_SMALL);
if (++v->age >= 55)
@@ -620,8 +620,8 @@ static void DisasterTick_4b(Vehicle *v)
for(i=0; i!=80; i++) {
uint32 r = Random();
CreateEffectVehicleAbove(
- v->x_pos-32+(r&0x3F),
- v->y_pos-32+(r>>5&0x3F),
+ GB(r, 0, 6) + v->x_pos - 32,
+ GB(r, 5, 6) + v->y_pos - 32,
0,
EV_EXPLOSION_SMALL);
}