MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GenerateLandscapeWindow

Method GenerateLandscapeWindow

src/genworld_gui.cpp:402–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400 GenerateLandscapeWindowMode mode{};
401
402 GenerateLandscapeWindow(WindowDesc &desc, WindowNumber number = 0) : Window(desc)
403 {
404 this->InitNested(number);
405
406 this->LowerWidget(to_underlying(_settings_newgame.game_creation.landscape) + WID_GL_TEMPERATE);
407
408 this->mode = this->window_number;
409
410 /* Disable town and industry in SE */
411 this->SetWidgetDisabledState(WID_GL_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
412 this->SetWidgetDisabledState(WID_GL_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
413
414 /* In case the map_height_limit is changed, clamp heightmap_height and custom_terrain_type. */
415 _settings_newgame.game_creation.heightmap_height = Clamp(_settings_newgame.game_creation.heightmap_height, MIN_HEIGHTMAP_HEIGHT, GetMapHeightLimit());
416 _settings_newgame.game_creation.custom_terrain_type = Clamp(_settings_newgame.game_creation.custom_terrain_type, MIN_CUSTOM_TERRAIN_TYPE, GetMapHeightLimit());
417
418 /* If original landgenerator is selected and alpinist terrain_type was selected, revert to mountainous. */
419 if (_settings_newgame.game_creation.land_generator == LG_ORIGINAL) {
420 _settings_newgame.difficulty.terrain_type = Clamp(_settings_newgame.difficulty.terrain_type, 0, 3);
421 }
422
423 this->OnInvalidateData();
424 }
425
426
427 std::string GetWidgetString(WidgetID widget, StringID stringid) const override

Callers

nothing calls this directly

Calls 7

OnInvalidateDataMethod · 0.95
to_underlyingFunction · 0.85
ClampFunction · 0.85
GetMapHeightLimitFunction · 0.85
InitNestedMethod · 0.80
LowerWidgetMethod · 0.80

Tested by

no test coverage detected