summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-14 09:21:05 +0000
committertron <tron@openttd.org>2005-11-14 09:21:05 +0000
commit6509e42db31f6fb7c13953664c3d73ea404c56d7 (patch)
tree0bb50211293afdb1d1e5d7c78f8c2e4d5a11506e /train_cmd.c
parentbb82872bbf4dbc78abf7381224f794b45669e077 (diff)
downloadopenttd-6509e42db31f6fb7c13953664c3d73ea404c56d7.tar.xz
(svn r3179) - RandomRange() and RandomTile() instead of home brewed versions
- CHANCE*() instead of mumbling strange numbers
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 3f2667ac2..68c72fa89 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1907,20 +1907,19 @@ static void HandleLocomotiveSmokeCloud(const Vehicle* v)
case 1:
// diesel smoke
- if (u->cur_speed <= 40 && GB(Random(), 0, 16) <= 0x1E00) {
+ if (u->cur_speed <= 40 && CHANCE16(15, 128)) {
CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE);
}
break;
case 2:
// blue spark
- if (GB(v->tick_counter, 0, 2) == 0 && GB(Random(), 0, 16) <= 0x5B0) {
+ if (GB(v->tick_counter, 0, 2) == 0 && CHANCE16(1, 45)) {
CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK);
}
break;
}
- } while ( (v = v->next) != NULL );
-
+ } while ((v = v->next) != NULL);
}
static void TrainPlayLeaveStationSound(const Vehicle* v)
@@ -3193,7 +3192,7 @@ static void HandleCrashedTrain(Vehicle *v)
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
}
- if (state <= 200 && GB(r = Random(), 0, 16) <= 0x2492) {
+ if (state <= 200 && CHANCE16R(1, 7, r)) {
index = (r * 10 >> 16);
u = v;