diff options
author | peter1138 <peter1138@openttd.org> | 2005-12-28 22:29:59 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2005-12-28 22:29:59 +0000 |
commit | 901068fd6e2b2c7059a59b5ec97c92e1ffe0633c (patch) | |
tree | 36bb1703510989fc2a6344323a6e775738b29355 /vehicle.c | |
parent | 139d1ed1ebc26ceeb1bb68af27d5d1644c5a988a (diff) | |
download | openttd-901068fd6e2b2c7059a59b5ec97c92e1ffe0633c.tar.xz |
(svn r3352) - NewGRF: Move initialization of vehicle random_bits to DC_EXEC blocks to allow use of Random() instead of InteractiveRandom(), which will alleviate some possible network desyncs.
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -254,16 +254,19 @@ static Vehicle *InitializeVehicle(Vehicle *v) v->next_shared = NULL; v->prev_shared = NULL; v->depot_list = NULL; - /* random_bits is used to pick out a random sprite for vehicles - which are technical the same (newgrf stuff). - Because RandomRange() results in desyncs, and because it does - not really matter that one client has other visual vehicles than - the other, it can be InteractiveRandomRange() without any problem - */ - v->random_bits = InteractiveRandomRange(256); + v->random_bits = 0; return v; } +/** + * Get a value for a vehicle's random_bits. + * @return A random value from 0 to 255. + */ +byte VehicleRandomBits(void) +{ + return GB(Random(), 0, 8); +} + Vehicle *ForceAllocateSpecialVehicle(void) { /* This stays a strange story.. there should always be room for special |