mirror of https://github.com/OpenTTD/OpenTTD
Change: Increase vehicle random data from 8 to 16 bits.
parent
4a5e413a6c
commit
7ccdefa1c1
|
@ -1207,7 +1207,7 @@ int GetEngineProperty(EngineID engine, PropertyID property, int orig_value, cons
|
|||
}
|
||||
|
||||
|
||||
static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_random_bits, bool first)
|
||||
static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, uint16_t base_random_bits, bool first)
|
||||
{
|
||||
/* We can't trigger a non-existent vehicle... */
|
||||
assert(v != nullptr);
|
||||
|
@ -1223,7 +1223,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_rando
|
|||
v->waiting_triggers = object.GetRemainingTriggers();
|
||||
|
||||
/* Rerandomise bits. Scopes other than SELF are invalid for rerandomisation. For bug-to-bug-compatibility with TTDP we ignore the scope. */
|
||||
byte new_random_bits = Random();
|
||||
uint16_t new_random_bits = Random();
|
||||
uint32 reseed = object.GetReseedSum();
|
||||
v->random_bits &= ~reseed;
|
||||
v->random_bits |= (first ? new_random_bits : base_random_bits) & reseed;
|
||||
|
|
|
@ -353,6 +353,8 @@ enum SaveLoadVersion : uint16 {
|
|||
SLV_LINKGRAPH_SECONDS, ///< 308 PR#10610 Store linkgraph update intervals in seconds instead of days.
|
||||
SLV_AI_START_DATE, ///< 309 PR#10653 Removal of individual AI start dates and added a generic one.
|
||||
|
||||
SLV_EXTEND_VEHICLE_RANDOM, ///< 310 PR#10701 Extend vehicle random bits.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
||||
|
|
|
@ -704,7 +704,8 @@ public:
|
|||
SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_FILE_U8 | SLE_VAR_U16, SLV_2, SLV_EXTEND_VEHICLE_RANDOM),
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT16, SLV_EXTEND_VEHICLE_RANDOM, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, SLV_2, SL_MAX_VERSION),
|
||||
|
|
|
@ -328,7 +328,7 @@ public:
|
|||
uint32 motion_counter; ///< counter to occasionally play a vehicle sound.
|
||||
byte progress; ///< The percentage (if divided by 256) this vehicle already crossed the tile unit.
|
||||
|
||||
byte random_bits; ///< Bits used for determining which randomized variational spritegroups to use when drawing.
|
||||
uint16_t random_bits; ///< Bits used for randomized variational spritegroups.
|
||||
byte waiting_triggers; ///< Triggers to be yet matched before rerandomizing the random bits.
|
||||
|
||||
StationID last_station_visited; ///< The last station we stopped at.
|
||||
|
|
Loading…
Reference in New Issue