OpenTTD
|
GUI to configure and show progress during map generation. More...
#include "stdafx.h"
#include "heightmap.h"
#include "debug.h"
#include "genworld.h"
#include "network/network.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 "querystring_gui.h"
#include "town.h"
#include "core/geometry_func.hpp"
#include "core/random_func.hpp"
#include "progress.h"
#include "error.h"
#include "widgets/genworld_widget.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | GenerateLandscapeWindow |
struct | CreateScenarioWindow |
struct | GenWorldStatus |
struct | GenerateProgressWindow |
Enumerations | |
enum | GenerateLandscapeWindowMode { GLWM_GENERATE, GLWM_HEIGHTMAP, GLWM_SCENARIO } |
Enum for the modes we can generate in. More... |
Functions | |
void | MakeNewgameSettingsLive () |
void | SetNewLandscapeType (byte landscape) |
Changes landscape type and sets genworld window dirty. | |
static void | StartGeneratingLandscape (GenerateLandscapeWindowMode mode) |
static void | LandscapeGenerationCallback (Window *w, bool confirmed) |
static DropDownList * | BuildMapsizeDropDown () |
assert_compile (lengthof(_num_inds)==ID_END+1) | |
static void | _ShowGenerateLandscape (GenerateLandscapeWindowMode mode) |
void | ShowGenerateLandscape () |
Start with a normal game. | |
void | ShowHeightmapLoad () |
Start with loading a heightmap. | |
void | StartScenarioEditor () |
Start with a scenario editor. | |
void | StartNewGameWithoutGUI (uint seed) |
Start a normal game without the GUI. | |
void | ShowCreateScenario () |
Show the window to create a scenario. | |
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, STR_TERRAIN_TYPE_ALPINIST, 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, STR_SEA_LEVEL_CUSTOM, INVALID_STRING_ID} |
static const StringID | _rivers [] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT, 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_FUNDING_ONLY, STR_MINIMAL, 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 WindowDesc | _generate_landscape_desc (WDP_CENTER, NULL, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, _nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)) |
static WindowDesc | _heightmap_load_desc (WDP_CENTER, NULL, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, _nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)) |
static const NWidgetPart | _nested_create_scenario_widgets [] |
static WindowDesc | _create_scenario_desc (WDP_CENTER, NULL, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, _nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets)) |
static const NWidgetPart | _nested_generate_progress_widgets [] |
static WindowDesc | _generate_progress_desc (WDP_CENTER, NULL, 0, 0, WC_MODAL_PROGRESS, WC_NONE, 0, _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.
Enum for the modes we can generate in.
GLWM_GENERATE |
Generate new game. |
GLWM_HEIGHTMAP |
Load from heightmap. |
GLWM_SCENARIO |
Generate flat land. |
Definition at line 40 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 1353 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), CreateRivers(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateTowns(), PlaceInitialIndustry(), PlaceTreeGroups(), 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 1339 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), CreateRivers(), GenerateIndustries(), GenerateLandscape(), GenerateTowns(), and GenerateTrees().
void SetNewLandscapeType | ( | byte | landscape | ) |
Changes landscape type and sets genworld window dirty.
landscape | new landscape type |
Definition at line 50 of file genworld_gui.cpp.
References _settings_newgame, GameSettings::game_creation, InvalidateWindowClassesData(), GameCreationSettings::landscape, WC_GENERATE_LANDSCAPE, and WC_SELECT_GAME.
Referenced by SelectGameWindow::OnClick(), GenerateLandscapeWindow::OnClick(), and CreateScenarioWindow::OnClick().
void ShowCreateScenario | ( | ) |
Show the window to create a scenario.
Definition at line 1119 of file genworld_gui.cpp.
References DeleteWindowByClass(), GLWM_SCENARIO, and WC_GENERATE_LANDSCAPE.
Referenced by ScenarioEditorLandscapeGenerationWindow::OnClick().
void ShowGenerateLandscape | ( | ) |
Start with a normal game.
Definition at line 851 of file genworld_gui.cpp.
References GLWM_GENERATE.
Referenced by SelectGameWindow::OnClick(), CreateScenarioWindow::OnClick(), and NetworkStartServerWindow::OnClick().
void ShowHeightmapLoad | ( | ) |
Start with loading a heightmap.
Definition at line 857 of file genworld_gui.cpp.
References GLWM_HEIGHTMAP.
Referenced by SaveLoadWindow::OnClick().
void StartNewGameWithoutGUI | ( | uint | seed | ) |
Start a normal game without the GUI.
seed | The seed of the new game. |
Definition at line 872 of file genworld_gui.cpp.
References _settings_newgame, GameSettings::game_creation, GameCreationSettings::generation_seed, and GLWM_GENERATE.
Referenced by VideoDriver_Dedicated::MainLoop(), NetworkCheckRestartMap(), SelectGameWindow::OnClick(), and NetworkStartServerWindow::OnClick().
void StartScenarioEditor | ( | ) |
Start with a scenario editor.
Definition at line 863 of file genworld_gui.cpp.
References GLWM_SCENARIO.
Referenced by SelectGameWindow::OnClick().
|
static |
Definition at line 1156 of file genworld_gui.cpp.
|
static |
Definition at line 1125 of file genworld_gui.cpp.