diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -344,8 +344,8 @@ CommandCost CmdBuildAircraft(DoCommandFl v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); u->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); - u->random_bits = VehicleRandomBits(); + v->random_bits = Random(); + u->random_bits = Random(); v->vehicle_flags = 0; if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); @@ -375,7 +375,7 @@ CommandCost CmdBuildAircraft(DoCommandFl w->spritenum = 0xFF; w->subtype = AIR_ROTOR; w->sprite_cache.sprite_seq.Set(SPR_ROTOR_STOPPED); - w->random_bits = VehicleRandomBits(); + w->random_bits = Random(); /* Use rotor's air.state to store the rotor animation frame */ w->state = HRS_ROTOR_STOPPED; w->UpdateDeltaXY(); diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -8,6 +8,7 @@ /** @file articulated_vehicles.cpp Implementation of articulated vehicles. */ #include "stdafx.h" +#include "core/random_func.hpp" #include "train.h" #include "roadveh.h" #include "vehicle_func.h" @@ -405,7 +406,7 @@ void AddArticulatedParts(Vehicle *first) v->engine_type = engine_type; v->value = 0; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); + v->random_bits = Random(); if (flip_image) v->spritenum++; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -303,7 +303,7 @@ CommandCost CmdBuildRoadVehicle(DoComman v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); + v->random_bits = Random(); v->SetFrontEngine(); v->roadtype = rt; diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -905,7 +905,7 @@ CommandCost CmdBuildShip(DoCommandFlag f v->date_of_last_service = TimerGameCalendar::date; v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); + v->random_bits = Random(); v->UpdateCache(); diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -656,7 +656,7 @@ static CommandCost CmdBuildRailWagon(DoC v->date_of_last_service = TimerGameCalendar::date; v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); + v->random_bits = Random(); v->group_id = DEFAULT_GROUP; @@ -721,7 +721,7 @@ static void AddRearEngineToMultiheadedTr u->date_of_last_service = v->date_of_last_service; u->build_year = v->build_year; u->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - u->random_bits = VehicleRandomBits(); + u->random_bits = Random(); v->SetMultiheaded(); u->SetMultiheaded(); v->SetNext(u); @@ -786,7 +786,7 @@ CommandCost CmdBuildRailVehicle(DoComman v->date_of_last_service = TimerGameCalendar::date; v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); - v->random_bits = VehicleRandomBits(); + v->random_bits = Random(); if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); v->SetServiceIntervalIsPercent(Company::Get(_current_company)->settings.vehicle.servint_ispercent); diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -359,15 +359,6 @@ Vehicle::Vehicle(VehicleType type) this->last_loading_station = INVALID_STATION; } -/** - * Get a value for a vehicle's random_bits. - * @return A random value from 0 to 255. - */ -byte VehicleRandomBits() -{ - return GB(Random(), 0, 8); -} - /* Size of the hash, 6 = 64 x 64, 7 = 128 x 128. Larger sizes will (in theory) reduce hash * lookup times at the expense of memory usage. */ const int HASH_BITS = 7; diff --git a/src/vehicle_func.h b/src/vehicle_func.h --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -50,7 +50,6 @@ uint8 CalcPercentVehicleFilled(const Veh void VehicleLengthChanged(const Vehicle *u); -byte VehicleRandomBits(); void ResetVehicleHash(); void ResetVehicleColourMap();