Add several NewGRF variables to vehicle image callback whitelist

Add vehicle flags to control cached image invalidation

Various refactorings
This commit is contained in:
Jonathan G Rennison
2020-08-25 01:26:44 +01:00
parent c82d372d54
commit 810bfd276e
45 changed files with 325 additions and 161 deletions

View File

@@ -268,7 +268,7 @@ TownScopeResolver *StationResolverObject::GetTown()
return this->town_scope;
}
/* virtual */ uint32 StationScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
/* virtual */ uint32 StationScopeResolver::GetVariable(byte variable, uint32 parameter, GetVariableExtra *extra) const
{
if (this->st == nullptr) {
/* Station does not exist, so we're in a purchase list or the land slope check callback. */
@@ -296,7 +296,7 @@ TownScopeResolver *StationResolverObject::GetTown()
case 0xFA: return Clamp(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Build date, clamped to a 16 bit value
}
*available = false;
extra->available = false;
return UINT_MAX;
}
@@ -386,7 +386,7 @@ TownScopeResolver *StationResolverObject::GetTown()
case 0xFA: return Clamp(this->st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535);
}
return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);
return this->st->GetNewGRFVariable(this->ro, variable, parameter, &(extra->available));
}
uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, byte parameter, bool *available) const