mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-20 02:42:42 +01:00
Codechange: Pass avail(able) as reference instead of pointer since they are never nullptr (#12696)
This commit is contained in:
@@ -412,7 +412,7 @@ static uint32_t PositionHelper(const Vehicle *v, bool consecutive)
|
||||
return chain_before | chain_after << 8 | (chain_before + chain_after + consecutive) << 16;
|
||||
}
|
||||
|
||||
static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, uint8_t variable, uint32_t parameter, bool *available)
|
||||
static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, uint8_t variable, uint32_t parameter, bool &available)
|
||||
{
|
||||
/* Calculated vehicle parameters */
|
||||
switch (variable) {
|
||||
@@ -935,11 +935,11 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
|
||||
|
||||
Debug(grf, 1, "Unhandled vehicle variable 0x{:X}, type 0x{:X}", variable, (uint)v->type);
|
||||
|
||||
*available = false;
|
||||
available = false;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
/* virtual */ uint32_t VehicleScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool *available) const
|
||||
/* virtual */ uint32_t VehicleScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const
|
||||
{
|
||||
if (this->v == nullptr) {
|
||||
/* Vehicle does not exist, so we're in a purchase list */
|
||||
@@ -968,7 +968,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
|
||||
case 0xF2: return 0; // Cargo subtype
|
||||
}
|
||||
|
||||
*available = false;
|
||||
available = false;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ void FillNewGRFVehicleCache(const Vehicle *v)
|
||||
/* Only resolve when the cache isn't valid. */
|
||||
if (HasBit(v->grf_cache.cache_valid, cache_entry[1])) continue;
|
||||
bool stub;
|
||||
ro.GetScope(VSG_SCOPE_SELF)->GetVariable(cache_entry[0], 0, &stub);
|
||||
ro.GetScope(VSG_SCOPE_SELF)->GetVariable(cache_entry[0], 0, stub);
|
||||
}
|
||||
|
||||
/* Make sure really all bits are set. */
|
||||
|
||||
Reference in New Issue
Block a user