Change: Hide all variants from UI when (display) parent is hidden. (#10708)

This commit is contained in:
2023-04-25 20:34:10 +01:00
committed by GitHub
parent 5794590b36
commit 1697dff744
4 changed files with 41 additions and 5 deletions

View File

@@ -137,6 +137,18 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> {
return c < MAX_COMPANIES && HasBit(this->company_hidden, c);
}
/**
* Get the last display variant for an engine.
* @return Engine's last display variant or engine itself if no last display variant is set.
*/
const Engine *GetDisplayVariant() const
{
if (this->display_last_variant == this->index || this->display_last_variant == INVALID_ENGINE) return this;
return Engine::Get(this->display_last_variant);
}
bool IsVariantHidden(CompanyID c) const;
/**
* Check if the engine is a ground vehicle.
* @return True iff the engine is a train or a road vehicle.