* Gets the desired height for the information panel. * @return the desired height in pixels. */
| 532 | * @return the desired height in pixels. |
| 533 | */ |
| 534 | uint GetDesiredInfoHeight(int width) const |
| 535 | { |
| 536 | uint aimed_height = static_cast<uint>(1 + CargoSpec::town_production_cargoes[TPE_PASSENGERS].size() + CargoSpec::town_production_cargoes[TPE_MAIL].size()) * GetCharacterHeight(FS_NORMAL); |
| 537 | |
| 538 | bool first = true; |
| 539 | for (int i = TAE_BEGIN; i < TAE_END; i++) { |
| 540 | if (this->town->goal[i] == 0) continue; |
| 541 | if (this->town->goal[i] == TOWN_GROWTH_WINTER && (TileHeight(this->town->xy) < LowestSnowLine() || this->town->cache.population <= 90)) continue; |
| 542 | if (this->town->goal[i] == TOWN_GROWTH_DESERT && (GetTropicZone(this->town->xy) != TROPICZONE_DESERT || this->town->cache.population <= 60)) continue; |
| 543 | |
| 544 | if (first) { |
| 545 | aimed_height += GetCharacterHeight(FS_NORMAL); |
| 546 | first = false; |
| 547 | } |
| 548 | aimed_height += GetCharacterHeight(FS_NORMAL); |
| 549 | } |
| 550 | aimed_height += GetCharacterHeight(FS_NORMAL); |
| 551 | |
| 552 | if (_settings_game.economy.station_noise_level) aimed_height += GetCharacterHeight(FS_NORMAL); |
| 553 | |
| 554 | if (!this->town->text.empty()) { |
| 555 | aimed_height += GetStringHeight(this->town->text.GetDecodedString(), width - WidgetDimensions::scaled.framerect.Horizontal()); |
| 556 | } |
| 557 | |
| 558 | return aimed_height; |
| 559 | } |
| 560 | |
| 561 | void ResizeWindowAsNeeded() |
| 562 | { |
nothing calls this directly
no test coverage detected