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 "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 "gfx_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 "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, 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_BORDER_TYPES,
  GLAND_BORDERS_RANDOM, GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE,
  GLAND_WATER_SW
}
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)
static void StartGeneratingLandscape (glwp_modes mode)
static void LandscapeGenerationCallback (Window *w, bool confirmed)
static DropDownListBuildMapsizeDropDown ()
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 NWidgetPart _nested_generate_landscape_widgets []
static const NWidgetPart _nested_heightmap_load_widgets []
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 tp_info _tp
static const StringID _generation_class_table [GWP_CLASS_COUNT]


Detailed Description

GUI to configure and show progress during map generation.

Definition in file genworld_gui.cpp.


Enumeration Type Documentation

Widget numbers of the create scenario window.

Enumerator:
CSCEN_TEMPERATE  Select temperate landscape style.
CSCEN_ARCTIC  Select arctic landscape style.
CSCEN_TROPICAL  Select tropical landscape style.
CSCEN_TOYLAND  Select toy-land landscape style.
CSCEN_EMPTY_WORLD  Generate an empty flat world.
CSCEN_RANDOM_WORLD  Generate random land button.
CSCEN_MAPSIZE_X_PULLDOWN  Pull-down arrow for x map size.
CSCEN_MAPSIZE_Y_PULLDOWN  Pull-down arrow for y map size.
CSCEN_START_DATE_DOWN  Decrease start year (start earlier).
CSCEN_START_DATE_TEXT  Clickable start date value.
CSCEN_START_DATE_UP  Increase start year (start later).
CSCEN_FLAT_LAND_HEIGHT_DOWN  Decrease flat land height.
CSCEN_FLAT_LAND_HEIGHT_TEXT  Clickable flat land height value.
CSCEN_FLAT_LAND_HEIGHT_UP  Increase flat land height.

Definition at line 825 of 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 1321 of file genworld_gui.cpp.

Referenced by _GenerateWorld(), GenerateTerrainPerlin(), GenerateTowns(), 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 1307 of file genworld_gui.cpp.

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


Variable Documentation

const StringID _generation_class_table[GWP_CLASS_COUNT] [static]

Initial value:

 {
  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 1124 of file genworld_gui.cpp.

const NWidgetPart _nested_generate_progress_widgets[] [static]

Initial value:

 {
  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 1093 of file genworld_gui.cpp.


Generated on Tue Jan 5 21:03:03 2010 for OpenTTD by  doxygen 1.5.6