# genworld_gui.cpp File Reference

GUI to configure and show progress during map generation. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "heightmap.h"`
`#include "gui.h"`
`#include "variables.h"`
`#include "settings_func.h"`
`#include "debug.h"`
`#include "genworld.h"`
`#include "network/network.h"`
`#include "newgrf_config.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "date_func.h"`
`#include "sound_func.h"`
`#include "fios.h"`
`#include "string_func.h"`
`#include "gfx_func.h"`
`#include "settings_type.h"`
`#include "widgets/dropdown_type.h"`
`#include "widgets/dropdown_func.h"`
`#include "core/random_func.hpp"`
`#include "landscape_type.h"`
`#include "querystring_gui.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | GenerateLandscapeWindow
struct | CreateScenarioWindow
struct | tp_info
struct | GenerateProgressWindow
## Enumerations
enum | glwp_modes { GLWP_GENERATE, GLWP_HEIGHTMAP, GLWP_SCENARIO, GLWP_END }
| In what 'mode' the GenerateLandscapeWindowProc is.
enum | GenerateLandscapeWindowWidgets { GLAND_TEMPERATE = 3, GLAND_ARCTIC, GLAND_TROPICAL, GLAND_TOYLAND, GLAND_MAPSIZE_X_TEXT, GLAND_MAPSIZE_X_PULLDOWN, GLAND_MAPSIZE_Y_TEXT, GLAND_MAPSIZE_Y_PULLDOWN, GLAND_TOWN_TEXT, GLAND_TOWN_PULLDOWN, GLAND_INDUSTRY_TEXT, GLAND_INDUSTRY_PULLDOWN, GLAND_RANDOM_TEXT, GLAND_RANDOM_EDITBOX, GLAND_RANDOM_BUTTON, GLAND_GENERATE_BUTTON, GLAND_START_DATE_TEXT1, GLAND_START_DATE_DOWN, GLAND_START_DATE_TEXT, GLAND_START_DATE_UP, GLAND_SNOW_LEVEL_TEXT1, GLAND_SNOW_LEVEL_DOWN, GLAND_SNOW_LEVEL_TEXT, GLAND_SNOW_LEVEL_UP, GLAND_TREE_TEXT, GLAND_TREE_PULLDOWN, GLAND_LANDSCAPE_TEXT, GLAND_LANDSCAPE_PULLDOWN, GLAND_HEIGHTMAP_ROTATION_TEXT = GLAND_LANDSCAPE_TEXT, GLAND_HEIGHTMAP_ROTATION_PULLDOWN = GLAND_LANDSCAPE_PULLDOWN, GLAND_TERRAIN_TEXT, GLAND_TERRAIN_PULLDOWN, GLAND_WATER_TEXT, GLAND_WATER_PULLDOWN, GLAND_SMOOTHNESS_TEXT, GLAND_SMOOTHNESS_PULLDOWN, GLAND_BORDER_TYPES, GLAND_BORDERS_RANDOM, GLAND_WATER_NW_TEXT, GLAND_WATER_NE_TEXT, GLAND_WATER_SE_TEXT, GLAND_WATER_SW_TEXT, GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW }
enum | CreateScenarioWindowWidgets { CSCEN_TEMPERATE = 3, CSCEN_ARCTIC, CSCEN_TROPICAL, CSCEN_TOYLAND, CSCEN_EMPTY_WORLD, CSCEN_RANDOM_WORLD, CSCEN_MAPSIZE_X_TEXT, CSCEN_MAPSIZE_X_PULLDOWN, CSCEN_MAPSIZE_Y_TEXT, CSCEN_MAPSIZE_Y_PULLDOWN, CSCEN_START_DATE_LABEL, CSCEN_START_DATE_DOWN, CSCEN_START_DATE_TEXT, CSCEN_START_DATE_UP, CSCEN_FLAT_LAND_HEIGHT_LABEL, CSCEN_FLAT_LAND_HEIGHT_DOWN, CSCEN_FLAT_LAND_HEIGHT_TEXT, CSCEN_FLAT_LAND_HEIGHT_UP }
## Functions
void | SwitchMode (int new_mode)
void | MakeNewgameSettingsLive ()
static void | SetNewLandscapeType (byte landscape)
void | StartGeneratingLandscape (glwp_modes mode)
static void | LandscapeGenerationCallback (Window *w, bool confirmed)
static DropDownList * | BuildMapsizeDropDown ()
static void | _ShowGenerateLandscape (glwp_modes mode)
void | ShowGenerateLandscape ()
void | ShowHeightmapLoad ()
void | StartScenarioEditor ()
void | StartNewGameWithoutGUI (uint seed)
void | ShowCreateScenario ()
static void | AbortGeneratingWorldCallback (Window *w, bool confirmed)
void | PrepareGenerateWorldProgress ()
| Initializes the progress counters to the starting point.
void | ShowGenerateWorldProgress ()
| Show the window where a user can follow the process of the map generation.
static void | _SetGeneratingWorldProgress (gwp_class cls, uint progress, uint total)
void | SetGeneratingWorldProgress (gwp_class cls, uint total)
| Set the total of a stage of the world generation.
void | IncreaseGeneratingWorldProgress (gwp_class cls)
| Increases the current stage of the world generation with one.
## Variables
static const Widget | _generate_landscape_widgets []
static const Widget | _heightmap_load_widgets []
static const StringID | _elevations [] = {STR_682A_VERY_FLAT, STR_682B_FLAT, STR_682C_HILLY, STR_682D_MOUNTAINOUS, INVALID_STRING_ID}
static const StringID | _sea_lakes [] = {STR_VERY_LOW, STR_6820_LOW, STR_6821_MEDIUM, STR_6822_HIGH, INVALID_STRING_ID}
static const StringID | _smoothness [] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID}
static const StringID | _tree_placer [] = {STR_CONFIG_SETTING_TREE_PLACER_NONE, STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL, STR_CONFIG_SETTING_TREE_PLACER_IMPROVED, INVALID_STRING_ID}
static const StringID | _rotation [] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID}
static const StringID | _landscape [] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID}
static const StringID | _num_towns [] = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID}
static const StringID | _num_inds [] = {STR_NONE, STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID}
static const WindowDesc | _generate_landscape_desc
static const WindowDesc | _heightmap_load_desc
static const Widget | _create_scenario_widgets []
static const WindowDesc | _create_scenario_desc
static const Widget | _generate_progress_widgets []
static const WindowDesc | _generate_progress_desc
static tp_info | _tp

## Detailed Description

GUI to configure and show progress during map generation.

Definition in file genworld_gui.cpp.

## Function Documentation

void IncreaseGeneratingWorldProgress | ( | gwp_class | cls | ) |

Increases the current stage of the world generation with one.

Parameters:

  | cls | the current class we are in.

Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. Also, progress works if total is zero, total works if progress is zero.

Definition at line 1090 of file genworld_gui.cpp.

Referenced by _GenerateWorld(), GenerateTerrainPerlin(), PlaceInitialIndustry(), and PlaceTreesRandomly().

void SetGeneratingWorldProgress | ( | gwp_class | cls,
|  | uint | total |
| ) |  |  |

Set the total of a stage of the world generation.

Parameters:

  | cls | the current class we are in.
  | total | Set the total expected items for this class.

Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. Also, progress works if total is zero, total works if progress is zero.

Definition at line 1076 of file genworld_gui.cpp.

Referenced by _GenerateWorld(), GenerateIndustries(), and GenerateTrees().

## Variable Documentation

const WindowDesc _create_scenario_desc`[static]`

Initial value:

     {
      WDP_CENTER, WDP_CENTER, 338, 170, 338, 170,
      WC_GENERATE_LANDSCAPE, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
      _create_scenario_widgets,
    }

Definition at line 879 of file genworld_gui.cpp.

const WindowDesc _generate_landscape_desc`[static]`

Initial value:

     {
      WDP_CENTER, WDP_CENTER, 338, 313, 338, 313,
      WC_GENERATE_LANDSCAPE, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
      _generate_landscape_widgets,
    }

Definition at line 631 of file genworld_gui.cpp.

const WindowDesc _generate_progress_desc`[static]`

Initial value:

     {
      WDP_CENTER, WDP_CENTER, 181, 97, 181, 97,
      WC_GENERATE_PROGRESS_WINDOW, WC_NONE,
      WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
      _generate_progress_widgets,
    }

Definition at line 900 of file genworld_gui.cpp.

const Widget _generate_progress_widgets[]`[static]`

Initial value:

     {
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    0,   180,     0,    13, STR_GENERATION_WORLD,   STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,    0,   180,    14,    96, 0x0,                    STR_NULL},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_WHITE,  20,   161,    74,    85, STR_GENERATION_ABORT,   STR_NULL},
    {   WIDGETS_END},
    }

Definition at line 893 of file genworld_gui.cpp.

const WindowDesc _heightmap_load_desc`[static]`

Initial value:

     {
      WDP_CENTER, WDP_CENTER, 338, 236, 338, 236,
      WC_GENERATE_LANDSCAPE, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
      _heightmap_load_widgets,
    }

Definition at line 638 of file genworld_gui.cpp.