mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 08:49:50 +00:00
Cleanup: Remove unnecessary VehicleRandomBits()
Simple Random() assignment to byte does the same.
This commit is contained in:
parent
ca497ce356
commit
4a5e413a6c
@ -344,8 +344,8 @@ CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *
|
||||
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(DoCommandFlag flags, TileIndex tile, const Engine *
|
||||
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();
|
||||
|
@ -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++;
|
||||
|
||||
|
@ -303,7 +303,7 @@ CommandCost CmdBuildRoadVehicle(DoCommandFlag flags, TileIndex tile, const Engin
|
||||
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;
|
||||
|
@ -905,7 +905,7 @@ CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, V
|
||||
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();
|
||||
|
||||
|
@ -656,7 +656,7 @@ static CommandCost CmdBuildRailWagon(DoCommandFlag flags, TileIndex tile, const
|
||||
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 AddRearEngineToMultiheadedTrain(Train *v)
|
||||
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(DoCommandFlag flags, TileIndex tile, const Engin
|
||||
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);
|
||||
|
@ -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;
|
||||
|
@ -50,7 +50,6 @@ uint8 CalcPercentVehicleFilled(const Vehicle *v, StringID *colour);
|
||||
|
||||
void VehicleLengthChanged(const Vehicle *u);
|
||||
|
||||
byte VehicleRandomBits();
|
||||
void ResetVehicleHash();
|
||||
void ResetVehicleColourMap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user