GUI to configure and show progress during map generation. More...
#include "stdafx.h"
#include "openttd.h"
#include "heightmap.h"
#include "variables.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 "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "landscape_type.h"
#include "querystring_gui.h"
#include "town.h"
#include "thread/thread.h"
#include "settings_func.h"
#include "core/geometry_func.hpp"
#include "core/random_func.hpp"
#include "table/strings.h"
#include "table/sprites.h"
Go to the source code of this file.
Data Structures | |
struct | GenerateLandscapeWindow |
struct | CreateScenarioWindow |
struct | GenWorldStatus |
struct | GenerateProgressWindow |
Enumerations | |
enum | GenenerateLandscapeWindowMode { GLWM_GENERATE, GLWM_HEIGHTMAP, GLWM_SCENARIO } |
In what 'mode' the GenerateLandscapeWindowProc is. More... | |
enum | GenerateLandscapeWindowWidgets { GLAND_TEMPERATE, GLAND_ARCTIC, GLAND_TROPICAL, GLAND_TOYLAND, GLAND_MAPSIZE_X_PULLDOWN, GLAND_MAPSIZE_Y_PULLDOWN, GLAND_TOWN_PULLDOWN, GLAND_INDUSTRY_PULLDOWN, GLAND_RANDOM_EDITBOX, GLAND_RANDOM_BUTTON, GLAND_GENERATE_BUTTON, GLAND_START_DATE_DOWN, GLAND_START_DATE_TEXT, GLAND_START_DATE_UP, GLAND_SNOW_LEVEL_DOWN, GLAND_SNOW_LEVEL_TEXT, GLAND_SNOW_LEVEL_UP, GLAND_TREE_PULLDOWN, GLAND_LANDSCAPE_PULLDOWN, GLAND_HEIGHTMAP_NAME_TEXT, GLAND_HEIGHTMAP_NAME_SPACER, GLAND_HEIGHTMAP_SIZE_TEXT, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, GLAND_TERRAIN_PULLDOWN, GLAND_WATER_PULLDOWN, GLAND_SMOOTHNESS_PULLDOWN, GLAND_VARIETY_PULLDOWN, GLAND_BORDERS_RANDOM, GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW } |
Widgets of GenerateLandscapeWindow. More... | |
enum | CreateScenarioWindowWidgets { CSCEN_TEMPERATE, CSCEN_ARCTIC, CSCEN_TROPICAL, CSCEN_TOYLAND, CSCEN_EMPTY_WORLD, CSCEN_RANDOM_WORLD, CSCEN_MAPSIZE_X_PULLDOWN, CSCEN_MAPSIZE_Y_PULLDOWN, CSCEN_START_DATE_DOWN, CSCEN_START_DATE_TEXT, CSCEN_START_DATE_UP, CSCEN_FLAT_LAND_HEIGHT_DOWN, CSCEN_FLAT_LAND_HEIGHT_TEXT, CSCEN_FLAT_LAND_HEIGHT_UP } |
Widget numbers of the create scenario window. More... | |
enum | GenerationProgressWindowWidgets { GPWW_PROGRESS_BAR, GPWW_PROGRESS_TEXT, GPWW_ABORT } |
Functions | |
void | SwitchToMode (SwitchMode new_mode) |
void | MakeNewgameSettingsLive () |
static void | SetNewLandscapeType (byte landscape) |
Changes landscape type and sets genworld window dirty. | |
static void | StartGeneratingLandscape (GenenerateLandscapeWindowMode mode) |
static void | LandscapeGenerationCallback (Window *w, bool confirmed) |
static DropDownList * | BuildMapsizeDropDown () |
static void | _ShowGenerateLandscape (GenenerateLandscapeWindowMode mode) |
void | ShowGenerateLandscape () |
void | ShowHeightmapLoad () |
void | StartScenarioEditor () |
void | StartNewGameWithoutGUI (uint seed) |
void | ShowCreateScenario () |
assert_compile (lengthof(_generation_class_table)==GWP_CLASS_COUNT) | |
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 (GenWorldProgress cls, uint progress, uint total) |
void | SetGeneratingWorldProgress (GenWorldProgress cls, uint total) |
Set the total of a stage of the world generation. | |
void | IncreaseGeneratingWorldProgress (GenWorldProgress cls) |
Increases the current stage of the world generation with one. | |
Variables | |
static const NWidgetPart | _nested_generate_landscape_widgets [] |
Widgets of GenerateLandscapeWindow when generating world. | |
static const NWidgetPart | _nested_heightmap_load_widgets [] |
Widgets of GenerateLandscapeWindow when loading heightmap. | |
static const StringID | _elevations [] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, INVALID_STRING_ID} |
static const StringID | _sea_lakes [] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_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_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID} |
static const StringID | _num_inds [] = {STR_NONE, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, INVALID_STRING_ID} |
static const StringID | _variety [] = {STR_VARIETY_NONE, STR_VARIETY_VERY_LOW, STR_VARIETY_LOW, STR_VARIETY_MEDIUM, STR_VARIETY_HIGH, STR_VARIETY_VERY_HIGH, INVALID_STRING_ID} |
static const WindowDesc | _generate_landscape_desc (WDP_CENTER, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)) |
static const WindowDesc | _heightmap_load_desc (WDP_CENTER, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)) |
static const NWidgetPart | _nested_create_scenario_widgets [] |
static const WindowDesc | _create_scenario_desc (WDP_CENTER, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets)) |
static const NWidgetPart | _nested_generate_progress_widgets [] |
static const WindowDesc | _generate_progress_desc (WDP_CENTER, 0, 0, WC_GENERATE_PROGRESS_WINDOW, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_generate_progress_widgets, lengthof(_nested_generate_progress_widgets)) |
static GenWorldStatus | _gws |
static const StringID | _generation_class_table [] |
GUI to configure and show progress during map generation.
Definition in file genworld_gui.cpp.
Widget numbers of the create scenario window.
Definition at line 834 of file genworld_gui.cpp.
In what 'mode' the GenerateLandscapeWindowProc is.
GLWM_GENERATE |
Generate new game. |
GLWM_HEIGHTMAP |
Load from heightmap. |
GLWM_SCENARIO |
Generate flat land. |
Definition at line 42 of file genworld_gui.cpp.
Widgets of GenerateLandscapeWindow.
Definition at line 63 of file genworld_gui.cpp.
void IncreaseGeneratingWorldProgress | ( | GenWorldProgress | cls | ) |
Increases the current stage of the world generation with one.
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 1332 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateTowns(), PlaceInitialIndustry(), and PlaceTreesRandomly().
void SetGeneratingWorldProgress | ( | GenWorldProgress | cls, | |
uint | total | |||
) |
Set the total of a stage of the world generation.
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 1318 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), GenerateIndustries(), GenerateLandscape(), GenerateTowns(), and GenerateTrees().
static void SetNewLandscapeType | ( | byte | landscape | ) | [inline, static] |
Changes landscape type and sets genworld window dirty.
landscape | new landscape type |
Definition at line 55 of file genworld_gui.cpp.
References _settings_newgame, GameSettings::game_creation, GameCreationSettings::landscape, and SetWindowClassesDirty().
Referenced by SelectGameWindow::OnClick(), CreateScenarioWindow::OnClick(), and GenerateLandscapeWindow::OnClick().
const StringID _generation_class_table[] [static] |
{ STR_GENERATION_WORLD_GENERATION, STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION, STR_GENERATION_CLEARING_TILES, STR_SCENEDIT_TOOLBAR_TOWN_GENERATION, STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION, STR_GENERATION_UNMOVABLE_GENERATION, STR_GENERATION_TREE_GENERATION, STR_GENERATION_SETTINGUP_GAME, STR_GENERATION_PREPARING_TILELOOP, STR_GENERATION_PREPARING_GAME }
Definition at line 1133 of file genworld_gui.cpp.
const NWidgetPart _nested_generate_progress_widgets[] [static] |
{ NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20), NWidget(NWID_VERTICAL), SetPIP(11, 8, 11), NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_BAR), SetFill(1, 0), NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_TEXT), SetFill(1, 0), NWidget(WWT_TEXTBTN, COLOUR_WHITE, GPWW_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), }
Definition at line 1102 of file genworld_gui.cpp.