* Update state of all Company (AI) buttons. */
| 937 | * Update state of all Company (AI) buttons. |
| 938 | */ |
| 939 | void UpdateAIButtonsState() |
| 940 | { |
| 941 | /* Update company buttons */ |
| 942 | for (CompanyID i = CompanyID::Begin(); i < MAX_COMPANIES; ++i) { |
| 943 | /* Mark dead/paused AIs by setting the background colour. */ |
| 944 | bool valid = Company::IsValidAiID(i); |
| 945 | bool dead = valid && Company::Get(i)->ai_instance->IsDead(); |
| 946 | bool paused = valid && Company::Get(i)->ai_instance->IsPaused(); |
| 947 | |
| 948 | NWidgetCore *button = this->GetWidget<NWidgetCore>(WID_SCRD_COMPANY_BUTTON_START + i); |
| 949 | button->SetDisabled(!valid); |
| 950 | button->SetLowered(this->filter.script_debug_company == i); |
| 951 | SetScriptButtonColour(*button, dead, paused); |
| 952 | } |
| 953 | } |
| 954 | |
| 955 | /** |
| 956 | * Update state of game script button. |
no test coverage detected