(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.
This commit is contained in:
17
vehicle.c
17
vehicle.c
@@ -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
|
||||
|
Reference in New Issue
Block a user