* Check whether the engine variant chain is hidden in the GUI for the given company. * @param c Company to check. * @return \c true iff the engine variant chain is hidden in the GUI for the given company. */
| 484 | * @return \c true iff the engine variant chain is hidden in the GUI for the given company. |
| 485 | */ |
| 486 | bool Engine::IsVariantHidden(CompanyID c) const |
| 487 | { |
| 488 | /* In case company is spectator. */ |
| 489 | if (c >= MAX_COMPANIES) return false; |
| 490 | |
| 491 | /* Shortcut if this engine is explicitly hidden. */ |
| 492 | if (this->IsHidden(c)) return true; |
| 493 | |
| 494 | /* Check for hidden parent variants. This is a bit convoluted as we must check hidden status of |
| 495 | * the last display variant rather than the actual parent variant. */ |
| 496 | const Engine *re = this; |
| 497 | const Engine *ve = re->GetDisplayVariant(); |
| 498 | while (!(ve->IsHidden(c)) && re->info.variant_id != EngineID::Invalid()) { |
| 499 | re = Engine::Get(re->info.variant_id); |
| 500 | ve = re->GetDisplayVariant(); |
| 501 | } |
| 502 | return ve->IsHidden(c); |
| 503 | } |
| 504 | |
| 505 | /** |
| 506 | * Initializes the #EngineOverrideManager with the default engines. |
no test coverage detected