| 313 | } |
| 314 | |
| 315 | void SetupArrays() |
| 316 | { |
| 317 | this->list.clear(); |
| 318 | |
| 319 | /* Fill the arrays with industries. |
| 320 | * The tests performed after the enabled allow to load the industries |
| 321 | * In the same way they are inserted by grf (if any) |
| 322 | */ |
| 323 | for (IndustryType ind : _sorted_industry_types) { |
| 324 | const IndustrySpec *indsp = GetIndustrySpec(ind); |
| 325 | if (indsp->enabled) { |
| 326 | /* Rule is that editor mode loads all industries. |
| 327 | * In game mode, all non raw industries are loaded too |
| 328 | * and raw ones are loaded only when setting allows it */ |
| 329 | if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) { |
| 330 | /* Unselect if the industry is no longer in the list */ |
| 331 | if (this->selected_type == ind) this->selected_type = IT_INVALID; |
| 332 | continue; |
| 333 | } |
| 334 | |
| 335 | this->list.push_back(ind); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | /* First industry type is selected if the current selection is invalid. */ |
| 340 | if (this->selected_type == IT_INVALID && !this->list.empty()) this->selected_type = this->list[0]; |
| 341 | |
| 342 | this->UpdateAvailability(); |
| 343 | |
| 344 | this->vscroll->SetCount(this->list.size()); |
| 345 | } |
| 346 | |
| 347 | /** Update status of the fund and display-chain widgets. */ |
| 348 | void SetButtons() |
no test coverage detected