2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file genworld_gui.cpp GUI to configure and show progress during map generation. */
|
2007-03-01 01:24:44 +00:00
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "heightmap.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "genworld.h"
|
2007-01-02 17:34:03 +00:00
|
|
|
#include "network/network.h"
|
2007-12-21 19:49:27 +00:00
|
|
|
#include "strings_func.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "window_func.h"
|
2007-12-26 13:50:40 +00:00
|
|
|
#include "date_func.h"
|
2007-12-29 09:24:26 +00:00
|
|
|
#include "sound_func.h"
|
2007-12-28 03:14:55 +00:00
|
|
|
#include "fios.h"
|
2008-01-07 14:23:25 +00:00
|
|
|
#include "string_func.h"
|
2008-01-17 14:00:17 +00:00
|
|
|
#include "widgets/dropdown_type.h"
|
2008-01-14 16:10:58 +00:00
|
|
|
#include "widgets/dropdown_func.h"
|
2008-05-11 12:26:20 +00:00
|
|
|
#include "querystring_gui.h"
|
2009-03-12 23:54:20 +00:00
|
|
|
#include "town.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "core/geometry_func.hpp"
|
|
|
|
#include "core/random_func.hpp"
|
2016-09-04 12:45:40 +00:00
|
|
|
#include "saveload/saveload.h"
|
2011-08-21 12:48:46 +00:00
|
|
|
#include "progress.h"
|
2011-12-10 15:14:11 +00:00
|
|
|
#include "error.h"
|
2021-01-12 22:02:16 +00:00
|
|
|
#include "newgrf_townname.h"
|
|
|
|
#include "townname_type.h"
|
2021-03-09 13:53:51 +00:00
|
|
|
#include "video/video_driver.hpp"
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2011-12-15 22:22:55 +00:00
|
|
|
#include "widgets/genworld_widget.h"
|
|
|
|
|
2014-04-23 20:13:33 +00:00
|
|
|
#include "safeguards.h"
|
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
|
2009-01-12 17:11:45 +00:00
|
|
|
extern void MakeNewgameSettingsLive();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
/** Enum for the modes we can generate in. */
|
2015-02-08 21:05:48 +00:00
|
|
|
enum GenerateLandscapeWindowMode {
|
2011-12-16 16:27:45 +00:00
|
|
|
GLWM_GENERATE, ///< Generate new game.
|
|
|
|
GLWM_HEIGHTMAP, ///< Load from heightmap.
|
|
|
|
GLWM_SCENARIO, ///< Generate flat land.
|
|
|
|
};
|
|
|
|
|
2010-01-18 14:58:32 +00:00
|
|
|
/**
|
|
|
|
* Changes landscape type and sets genworld window dirty
|
|
|
|
* @param landscape new landscape type
|
|
|
|
*/
|
2010-05-21 06:59:45 +00:00
|
|
|
void SetNewLandscapeType(byte landscape)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2008-05-26 00:31:36 +00:00
|
|
|
_settings_newgame.game_creation.landscape = landscape;
|
2010-05-21 06:59:45 +00:00
|
|
|
InvalidateWindowClassesData(WC_SELECT_GAME);
|
|
|
|
InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2010-01-18 14:58:32 +00:00
|
|
|
/** Widgets of GenerateLandscapeWindow when generating world */
|
2009-04-03 11:59:41 +00:00
|
|
|
static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_BROWN),
|
2009-04-03 11:59:41 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 10),
|
|
|
|
/* Landscape selection. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 11),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 5, 10),
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
|
|
|
|
/* Left column with labels. */
|
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2013-01-20 14:51:50 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_LAND_GENERATOR, STR_NULL), SetFill(1, 1),
|
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TERRAIN_TYPE, STR_NULL), SetFill(1, 1),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
|
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
|
2010-01-18 14:58:32 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-08 16:46:23 +00:00
|
|
|
/* Widgets at the right of the labels. */
|
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
|
|
|
/* Mapsize X * Y. */
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
|
2013-01-20 14:51:50 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 0),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1),
|
2013-01-20 14:51:50 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 0),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2012-11-11 16:10:11 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
|
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SMOOTHNESS, STR_NULL), SetFill(1, 1),
|
2014-04-27 15:15:28 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1),
|
2021-01-12 22:02:16 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2014-09-21 12:25:04 +00:00
|
|
|
/* Max. heightlevel. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN), SetFill(0, 1),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_MAX_HEIGHTLEVEL_UP), SetFill(0, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Snow line. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
2014-09-21 12:25:04 +00:00
|
|
|
/* Starting date. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
|
|
|
|
EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2014-04-27 15:15:28 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2021-01-12 22:02:16 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWNNAME_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2015-02-01 22:04:50 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 0), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 4),
|
|
|
|
/* Map borders buttons for each edge. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2012-11-11 16:10:11 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_NE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHEAST), SetFill(1, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
2012-11-11 16:10:11 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_SE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHEAST), SetFill(1, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2010-01-18 14:58:32 +00:00
|
|
|
/** Widgets of GenerateLandscapeWindow when loading heightmap */
|
2009-04-03 11:59:41 +00:00
|
|
|
static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
|
|
|
/* Window header. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_BROWN),
|
2009-04-03 11:59:41 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 10),
|
|
|
|
/* Landscape selection. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 11), SetFill(0, 1),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10),
|
2009-04-03 11:59:41 +00:00
|
|
|
/* Labels at the left side. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_NAME, STR_NULL), SetFill(1, 1),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE_LABEL, STR_NULL), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetFill(1, 1),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_ROTATION, STR_NULL), SetFill(1, 1),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
|
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
|
2011-09-06 18:32:48 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Widgets at the right of the labels. */
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_GL_HEIGHTMAP_NAME_TEXT), SetFill(1, 0),
|
2011-09-06 20:33:56 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 0),
|
2009-11-08 16:46:23 +00:00
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE, WID_GL_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0),
|
2011-09-06 20:33:56 +00:00
|
|
|
/* Mapsize X * Y. */
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
|
2011-09-06 20:33:56 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_HEIGHTMAP_ROTATION_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
2011-09-06 20:33:56 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
|
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
|
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
|
2021-01-12 22:02:16 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
|
2011-09-06 20:33:56 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
2014-09-21 12:25:04 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN), SetFill(0, 1),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_MAX_HEIGHTLEVEL_UP), SetFill(0, 1),
|
|
|
|
EndContainer(),
|
2021-01-12 20:41:01 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
|
|
|
|
EndContainer(),
|
2011-09-06 20:33:56 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
|
2012-11-11 16:09:08 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
|
2011-09-06 20:33:56 +00:00
|
|
|
EndContainer(),
|
2021-01-12 22:02:16 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWNNAME_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0),
|
2011-09-06 20:33:56 +00:00
|
|
|
EndContainer(),
|
2009-11-08 16:46:23 +00:00
|
|
|
EndContainer(),
|
2015-02-01 22:04:50 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 0), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetFill(1, 1),
|
2009-04-03 11:59:41 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2015-02-08 21:05:48 +00:00
|
|
|
static void StartGeneratingLandscape(GenerateLandscapeWindowMode mode)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2007-02-01 22:54:04 +00:00
|
|
|
DeleteAllNonVitalWindows();
|
2011-12-10 15:14:11 +00:00
|
|
|
ClearErrorMessages();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2009-02-14 23:17:32 +00:00
|
|
|
/* Copy all XXX_newgame to XXX when coming from outside the editor */
|
|
|
|
MakeNewgameSettingsLive();
|
2006-12-04 08:30:04 +00:00
|
|
|
ResetGRFConfig(true);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2012-12-23 21:09:09 +00:00
|
|
|
if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
switch (mode) {
|
2010-01-18 12:53:01 +00:00
|
|
|
case GLWM_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break;
|
|
|
|
case GLWM_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
|
|
|
|
case GLWM_SCENARIO: _switch_mode = SM_EDITOR; break;
|
2007-02-01 16:21:56 +00:00
|
|
|
default: NOT_REACHED();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-04 16:27:13 +00:00
|
|
|
static void LandscapeGenerationCallback(Window *w, bool confirmed)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2015-02-08 21:05:48 +00:00
|
|
|
if (confirmed) StartGeneratingLandscape((GenerateLandscapeWindowMode)w->window_number);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 19:31:24 +00:00
|
|
|
static DropDownList BuildMapsizeDropDown()
|
2008-01-17 14:00:17 +00:00
|
|
|
{
|
2019-04-02 19:31:24 +00:00
|
|
|
DropDownList list;
|
2008-01-17 14:00:17 +00:00
|
|
|
|
2009-06-23 23:42:37 +00:00
|
|
|
for (uint i = MIN_MAP_SIZE_BITS; i <= MAX_MAP_SIZE_BITS; i++) {
|
2008-01-17 14:00:17 +00:00
|
|
|
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
2018-06-10 13:36:55 +00:00
|
|
|
item->SetParam(0, 1LL << i);
|
2019-04-02 19:31:24 +00:00
|
|
|
list.emplace_back(item);
|
2008-01-17 14:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2021-01-12 22:02:16 +00:00
|
|
|
static DropDownList BuildTownNameDropDown()
|
|
|
|
{
|
|
|
|
DropDownList list;
|
|
|
|
|
|
|
|
/* Add and sort newgrf townnames generators */
|
|
|
|
const auto &grf_names = GetGRFTownNameList();
|
|
|
|
for (uint i = 0; i < grf_names.size(); i++) {
|
|
|
|
list.emplace_back(new DropDownListStringItem(grf_names[i], BUILTIN_TOWNNAME_GENERATOR_COUNT + i, false));
|
|
|
|
}
|
|
|
|
std::sort(list.begin(), list.end(), DropDownListStringItem::NatSortFunc);
|
|
|
|
|
|
|
|
size_t newgrf_size = list.size();
|
|
|
|
/* Insert newgrf_names at the top of the list */
|
|
|
|
if (newgrf_size > 0) {
|
|
|
|
list.emplace_back(new DropDownListItem(-1, false)); // separator line
|
|
|
|
newgrf_size++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add and sort original townnames generators */
|
|
|
|
for (uint i = 0; i < BUILTIN_TOWNNAME_GENERATOR_COUNT; i++) {
|
|
|
|
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, false));
|
|
|
|
}
|
|
|
|
std::sort(list.begin() + newgrf_size, list.end(), DropDownListStringItem::NatSortFunc);
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-13 14:22:48 +00:00
|
|
|
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};
|
2010-09-20 18:56:35 +00:00
|
|
|
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};
|
2011-08-20 14:14:17 +00:00
|
|
|
static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT, INVALID_STRING_ID};
|
2009-02-08 12:25:13 +00:00
|
|
|
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 _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};
|
2009-04-21 23:40:56 +00:00
|
|
|
static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID};
|
2011-02-05 11:42:27 +00:00
|
|
|
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};
|
2009-12-19 18:36:35 +00:00
|
|
|
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};
|
2007-05-04 16:27:13 +00:00
|
|
|
|
2020-12-27 10:44:22 +00:00
|
|
|
static_assert(lengthof(_num_inds) == ID_END + 1);
|
2011-02-06 18:11:39 +00:00
|
|
|
|
2012-11-14 22:50:35 +00:00
|
|
|
struct GenerateLandscapeWindow : public Window {
|
2008-05-11 12:26:20 +00:00
|
|
|
uint widget_id;
|
|
|
|
uint x;
|
|
|
|
uint y;
|
|
|
|
char name[64];
|
2015-02-08 21:05:48 +00:00
|
|
|
GenerateLandscapeWindowMode mode;
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2014-04-27 15:15:28 +00:00
|
|
|
GenerateLandscapeWindow(WindowDesc *desc, WindowNumber number = 0) : Window(desc)
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(number);
|
2009-11-08 13:35:45 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->LowerWidget(_settings_newgame.game_creation.landscape + WID_GL_TEMPERATE);
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2015-02-08 21:05:48 +00:00
|
|
|
this->mode = (GenerateLandscapeWindowMode)this->window_number;
|
2010-05-21 06:59:45 +00:00
|
|
|
|
2021-01-12 20:29:33 +00:00
|
|
|
/* Disable town and industry in SE */
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetDisabledState(WID_GL_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
|
2010-05-21 08:23:46 +00:00
|
|
|
|
2010-05-21 06:59:45 +00:00
|
|
|
this->OnInvalidateData();
|
2009-11-08 13:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void SetStringParameters(int widget) const override
|
2009-11-08 13:35:45 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break;
|
2018-06-10 13:36:55 +00:00
|
|
|
case WID_GL_MAPSIZE_X_PULLDOWN: SetDParam(0, 1LL << _settings_newgame.game_creation.map_x); break;
|
|
|
|
case WID_GL_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1LL << _settings_newgame.game_creation.map_y); break;
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_TEXT: SetDParam(0, _settings_newgame.construction.max_heightlevel); break;
|
|
|
|
case WID_GL_SNOW_LEVEL_TEXT: SetDParam(0, _settings_newgame.game_creation.snow_line_height); break;
|
2010-09-20 18:48:33 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TOWN_PULLDOWN:
|
2010-09-20 18:48:33 +00:00
|
|
|
if (_game_mode == GM_EDITOR) {
|
2011-03-06 15:52:23 +00:00
|
|
|
SetDParam(0, STR_CONFIG_SETTING_OFF);
|
2010-09-20 18:48:33 +00:00
|
|
|
} else if (_settings_newgame.difficulty.number_towns == CUSTOM_TOWN_NUMBER_DIFFICULTY) {
|
|
|
|
SetDParam(0, STR_NUM_CUSTOM_NUMBER);
|
|
|
|
SetDParam(1, _settings_newgame.game_creation.custom_town_number);
|
|
|
|
} else {
|
|
|
|
SetDParam(0, _num_towns[_settings_newgame.difficulty.number_towns]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-01-12 22:02:16 +00:00
|
|
|
case WID_GL_TOWNNAME_DROPDOWN: {
|
|
|
|
uint gen = _settings_newgame.game_creation.town_name;
|
|
|
|
StringID name = gen < BUILTIN_TOWNNAME_GENERATOR_COUNT ?
|
|
|
|
STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + gen :
|
|
|
|
GetGRFTownNameName(gen - BUILTIN_TOWNNAME_GENERATOR_COUNT);
|
|
|
|
SetDParam(0, name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_CONFIG_SETTING_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break;
|
|
|
|
case WID_GL_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break;
|
|
|
|
case WID_GL_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break;
|
2010-09-20 18:56:35 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_PULLDOWN:
|
2010-09-20 18:56:35 +00:00
|
|
|
if (_settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) {
|
|
|
|
SetDParam(0, STR_SEA_LEVEL_CUSTOM_PERCENTAGE);
|
|
|
|
SetDParam(1, _settings_newgame.game_creation.custom_sea_level);
|
|
|
|
} else {
|
|
|
|
SetDParam(0, _sea_lakes[_settings_newgame.difficulty.quantity_sea_lakes]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break;
|
|
|
|
case WID_GL_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break;
|
|
|
|
case WID_GL_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break;
|
|
|
|
case WID_GL_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break;
|
|
|
|
case WID_GL_WATER_NE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
|
|
|
|
case WID_GL_WATER_NW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
|
|
|
|
case WID_GL_WATER_SE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
|
|
|
|
case WID_GL_WATER_SW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
|
|
|
|
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: SetDParam(0, _rotation[_settings_newgame.game_creation.heightmap_rotation]); break;
|
2009-11-08 16:46:23 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_SIZE_TEXT:
|
2009-11-08 16:46:23 +00:00
|
|
|
if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
|
|
|
|
SetDParam(0, this->y);
|
|
|
|
SetDParam(1, this->x);
|
|
|
|
} else {
|
|
|
|
SetDParam(0, this->x);
|
|
|
|
SetDParam(1, this->y);
|
|
|
|
}
|
|
|
|
break;
|
2009-11-08 13:35:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-13 21:31:29 +00:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
|
|
|
*/
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
2010-05-21 06:59:45 +00:00
|
|
|
{
|
2011-03-13 21:31:29 +00:00
|
|
|
if (!gui_scope) return;
|
2010-05-21 06:59:45 +00:00
|
|
|
/* Update the climate buttons */
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetLoweredState(WID_GL_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
|
|
|
|
this->SetWidgetLoweredState(WID_GL_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
|
|
|
|
this->SetWidgetLoweredState(WID_GL_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC);
|
|
|
|
this->SetWidgetLoweredState(WID_GL_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND);
|
2010-05-21 08:23:46 +00:00
|
|
|
|
|
|
|
/* You can't select smoothness / non-water borders if not terragenesis */
|
|
|
|
if (mode == GLWM_GENERATE) {
|
2015-05-16 12:01:19 +00:00
|
|
|
this->SetWidgetDisabledState(WID_GL_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == LG_ORIGINAL);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == LG_ORIGINAL);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges);
|
|
|
|
this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM,
|
2011-12-16 16:27:45 +00:00
|
|
|
WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END);
|
2010-05-21 08:23:46 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM);
|
2010-05-21 08:23:46 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetLoweredState(WID_GL_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW));
|
|
|
|
this->SetWidgetLoweredState(WID_GL_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE));
|
|
|
|
this->SetWidgetLoweredState(WID_GL_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE));
|
|
|
|
this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW));
|
2010-05-21 08:23:46 +00:00
|
|
|
|
2015-05-16 12:01:19 +00:00
|
|
|
this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC),
|
2011-12-16 16:27:45 +00:00
|
|
|
WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END);
|
2010-05-21 08:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable snowline if not arctic */
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC);
|
2010-05-21 08:23:46 +00:00
|
|
|
|
|
|
|
/* Update availability of decreasing / increasing start date and snow level */
|
2014-09-21 12:25:04 +00:00
|
|
|
this->SetWidgetDisabledState(WID_GL_MAX_HEIGHTLEVEL_DOWN, _settings_newgame.construction.max_heightlevel <= MIN_MAX_HEIGHTLEVEL);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_MAX_HEIGHTLEVEL_UP, _settings_newgame.construction.max_heightlevel >= MAX_MAX_HEIGHTLEVEL);
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetDisabledState(WID_GL_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
|
|
|
|
this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
|
2010-11-04 18:34:37 +00:00
|
|
|
|
|
|
|
/* Do not allow a custom sea level with the original land generator. */
|
2015-05-16 12:01:19 +00:00
|
|
|
if (_settings_newgame.game_creation.land_generator == LG_ORIGINAL &&
|
2010-11-04 18:34:37 +00:00
|
|
|
_settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) {
|
|
|
|
_settings_newgame.difficulty.quantity_sea_lakes = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE;
|
|
|
|
}
|
|
|
|
|
2010-05-21 06:59:45 +00:00
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
2009-11-08 13:35:45 +00:00
|
|
|
{
|
2019-04-10 21:07:06 +00:00
|
|
|
const StringID *strs = nullptr;
|
2009-11-08 13:35:45 +00:00
|
|
|
switch (widget) {
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_TEXT:
|
|
|
|
SetDParam(0, MAX_TILE_HEIGHT);
|
|
|
|
*size = GetStringBoundingBox(STR_JUST_INT);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_START_DATE_TEXT:
|
2009-11-08 13:35:45 +00:00
|
|
|
SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_BLACK_DATE_LONG));
|
2009-11-08 13:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_MAPSIZE_X_PULLDOWN:
|
|
|
|
case WID_GL_MAPSIZE_Y_PULLDOWN:
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, MAX_MAP_SIZE);
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT));
|
2009-11-08 13:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_SNOW_LEVEL_TEXT:
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, MAX_TILE_HEIGHT);
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT));
|
2009-11-08 16:46:23 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_SIZE_TEXT:
|
2009-11-08 16:46:23 +00:00
|
|
|
SetDParam(0, this->x);
|
|
|
|
SetDParam(1, this->y);
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_MAPGEN_HEIGHTMAP_SIZE));
|
2009-11-08 16:46:23 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TOWN_PULLDOWN:
|
2010-09-20 18:48:33 +00:00
|
|
|
strs = _num_towns;
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, CUSTOM_TOWN_MAX_NUMBER);
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER));
|
2010-09-20 18:48:33 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_INDUSTRY_PULLDOWN: strs = _num_inds; break;
|
|
|
|
case WID_GL_LANDSCAPE_PULLDOWN: strs = _landscape; break;
|
|
|
|
case WID_GL_TERRAIN_PULLDOWN: strs = _elevations; break;
|
|
|
|
case WID_GL_WATER_PULLDOWN:
|
2010-09-20 18:56:35 +00:00
|
|
|
strs = _sea_lakes;
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE);
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_SEA_LEVEL_CUSTOM_PERCENTAGE));
|
2010-09-20 18:56:35 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_RIVER_PULLDOWN: strs = _rivers; break;
|
|
|
|
case WID_GL_SMOOTHNESS_PULLDOWN: strs = _smoothness; break;
|
|
|
|
case WID_GL_VARIETY_PULLDOWN: strs = _variety; break;
|
|
|
|
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break;
|
|
|
|
case WID_GL_BORDERS_RANDOM:
|
2009-11-08 16:46:23 +00:00
|
|
|
*size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOMIZE), GetStringBoundingBox(STR_MAPGEN_BORDER_MANUAL));
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_NE:
|
|
|
|
case WID_GL_WATER_NW:
|
|
|
|
case WID_GL_WATER_SE:
|
|
|
|
case WID_GL_WATER_SW:
|
2009-11-08 16:46:23 +00:00
|
|
|
*size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOM), maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_WATER), GetStringBoundingBox(STR_MAPGEN_BORDER_FREEFORM)));
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_NAME_TEXT:
|
2009-11-08 16:46:23 +00:00
|
|
|
size->width = 0;
|
2009-11-08 13:35:45 +00:00
|
|
|
break;
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2009-11-08 13:35:45 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2019-04-10 21:07:06 +00:00
|
|
|
if (strs != nullptr) {
|
2009-11-08 16:46:23 +00:00
|
|
|
while (*strs != INVALID_STRING_ID) {
|
|
|
|
*size = maxdim(*size, GetStringBoundingBox(*strs++));
|
|
|
|
}
|
|
|
|
}
|
2009-11-08 13:35:45 +00:00
|
|
|
size->width += padding.width;
|
2021-01-08 10:16:18 +00:00
|
|
|
size->height = std::max(size->height, (uint)(FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM));
|
2009-11-08 16:46:23 +00:00
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void DrawWidget(const Rect &r, int widget) const override
|
2009-11-08 16:46:23 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_NAME_TEXT: {
|
2011-09-06 20:33:56 +00:00
|
|
|
DrawString(r.left, r.right, r.top, this->name, TC_ORANGE);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-11-08 16:46:23 +00:00
|
|
|
}
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TEMPERATE:
|
|
|
|
case WID_GL_ARCTIC:
|
|
|
|
case WID_GL_TROPICAL:
|
|
|
|
case WID_GL_TOYLAND:
|
|
|
|
SetNewLandscapeType(widget - WID_GL_TEMPERATE);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_MAPSIZE_X_PULLDOWN: // Mapsize X
|
|
|
|
ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_GL_MAPSIZE_X_PULLDOWN);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_MAPSIZE_Y_PULLDOWN: // Mapsize Y
|
|
|
|
ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_GL_MAPSIZE_Y_PULLDOWN);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TOWN_PULLDOWN: // Number of towns
|
|
|
|
ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, WID_GL_TOWN_PULLDOWN, 0, 0);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2021-01-12 22:02:16 +00:00
|
|
|
case WID_GL_TOWNNAME_DROPDOWN: // Townname generator
|
|
|
|
ShowDropDownList(this, BuildTownNameDropDown(), _settings_newgame.game_creation.town_name, WID_GL_TOWNNAME_DROPDOWN);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_INDUSTRY_PULLDOWN: // Number of industries
|
|
|
|
ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, WID_GL_INDUSTRY_PULLDOWN, 0, 0);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_GENERATE_BUTTON: { // Generate
|
2011-06-26 16:16:04 +00:00
|
|
|
/* Get rotated map size. */
|
|
|
|
uint map_x;
|
|
|
|
uint map_y;
|
|
|
|
if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
|
|
|
|
map_x = this->y;
|
|
|
|
map_y = this->x;
|
|
|
|
} else {
|
|
|
|
map_x = this->x;
|
|
|
|
map_y = this->y;
|
|
|
|
}
|
2010-01-18 12:53:01 +00:00
|
|
|
if (mode == GLWM_HEIGHTMAP &&
|
2011-06-26 16:16:04 +00:00
|
|
|
(map_x * 2 < (1U << _settings_newgame.game_creation.map_x) ||
|
|
|
|
map_x / 2 > (1U << _settings_newgame.game_creation.map_x) ||
|
|
|
|
map_y * 2 < (1U << _settings_newgame.game_creation.map_y) ||
|
|
|
|
map_y / 2 > (1U << _settings_newgame.game_creation.map_y))) {
|
2008-05-11 12:26:20 +00:00
|
|
|
ShowQuery(
|
2009-08-05 17:59:21 +00:00
|
|
|
STR_WARNING_HEIGHTMAP_SCALE_CAPTION,
|
|
|
|
STR_WARNING_HEIGHTMAP_SCALE_MESSAGE,
|
2008-05-11 12:26:20 +00:00
|
|
|
this,
|
|
|
|
LandscapeGenerationCallback);
|
|
|
|
} else {
|
|
|
|
StartGeneratingLandscape(mode);
|
|
|
|
}
|
|
|
|
break;
|
2011-06-26 16:16:04 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_DOWN:
|
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_UP: // Height level buttons
|
|
|
|
/* Don't allow too fast scrolling */
|
|
|
|
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
|
|
|
|
this->HandleButtonClick(widget);
|
|
|
|
|
|
|
|
_settings_newgame.construction.max_heightlevel = Clamp(_settings_newgame.construction.max_heightlevel + widget - WID_GL_MAX_HEIGHTLEVEL_TEXT, MIN_MAX_HEIGHTLEVEL, MAX_MAX_HEIGHTLEVEL);
|
|
|
|
this->InvalidateData();
|
|
|
|
}
|
|
|
|
_left_button_clicked = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_TEXT: // Height level text
|
|
|
|
this->widget_id = WID_GL_MAX_HEIGHTLEVEL_TEXT;
|
|
|
|
SetDParam(0, _settings_newgame.construction.max_heightlevel);
|
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_MAX_HEIGHTLEVEL_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_START_DATE_DOWN:
|
|
|
|
case WID_GL_START_DATE_UP: // Year buttons
|
2008-05-11 12:26:20 +00:00
|
|
|
/* Don't allow too fast scrolling */
|
2011-12-17 20:52:07 +00:00
|
|
|
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
|
2008-05-11 12:26:20 +00:00
|
|
|
this->HandleButtonClick(widget);
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
_left_button_clicked = false;
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_START_DATE_TEXT: // Year text
|
|
|
|
this->widget_id = WID_GL_START_DATE_TEXT;
|
2008-05-25 19:17:03 +00:00
|
|
|
SetDParam(0, _settings_newgame.game_creation.starting_year);
|
2011-04-17 18:42:17 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_SNOW_LEVEL_DOWN:
|
|
|
|
case WID_GL_SNOW_LEVEL_UP: // Snow line buttons
|
2008-05-11 12:26:20 +00:00
|
|
|
/* Don't allow too fast scrolling */
|
2011-12-17 20:52:07 +00:00
|
|
|
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
|
2008-05-11 12:26:20 +00:00
|
|
|
this->HandleButtonClick(widget);
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
_settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - WID_GL_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
_left_button_clicked = false;
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_SNOW_LEVEL_TEXT: // Snow line text
|
|
|
|
this->widget_id = WID_GL_SNOW_LEVEL_TEXT;
|
2008-05-25 19:17:03 +00:00
|
|
|
SetDParam(0, _settings_newgame.game_creation.snow_line_height);
|
2014-10-25 21:02:59 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_LANDSCAPE_PULLDOWN: // Landscape generator
|
|
|
|
ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, WID_GL_LANDSCAPE_PULLDOWN, 0, 0);
|
2009-11-08 13:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation
|
|
|
|
ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, WID_GL_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TERRAIN_PULLDOWN: // Terrain type
|
2014-10-13 14:22:48 +00:00
|
|
|
/* For the original map generation only the first four are valid. */
|
|
|
|
ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, WID_GL_TERRAIN_PULLDOWN, 0, _settings_newgame.game_creation.land_generator == LG_ORIGINAL ? ~0xF : 0);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_PULLDOWN: { // Water quantity
|
2010-11-04 18:34:37 +00:00
|
|
|
uint32 hidden_mask = 0;
|
|
|
|
/* Disable custom water level when the original map generator is active. */
|
2015-05-16 12:01:19 +00:00
|
|
|
if (_settings_newgame.game_creation.land_generator == LG_ORIGINAL) {
|
2010-11-04 18:34:37 +00:00
|
|
|
SetBit(hidden_mask, CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY);
|
|
|
|
}
|
2011-12-16 16:27:45 +00:00
|
|
|
ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, WID_GL_WATER_PULLDOWN, 0, hidden_mask);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
2010-11-04 18:34:37 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_RIVER_PULLDOWN: // Amount of rivers
|
|
|
|
ShowDropDownMenu(this, _rivers, _settings_newgame.game_creation.amount_of_rivers, WID_GL_RIVER_PULLDOWN, 0, 0);
|
2011-08-20 14:14:17 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_SMOOTHNESS_PULLDOWN: // Map smoothness
|
|
|
|
ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, WID_GL_SMOOTHNESS_PULLDOWN, 0, 0);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
2009-01-21 02:31:55 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_VARIETY_PULLDOWN: // Map variety
|
|
|
|
ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, WID_GL_VARIETY_PULLDOWN, 0, 0);
|
2009-12-19 18:00:38 +00:00
|
|
|
break;
|
|
|
|
|
2009-01-23 00:18:27 +00:00
|
|
|
/* Freetype map borders */
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_NW:
|
2009-01-23 00:18:27 +00:00
|
|
|
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NW);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2009-01-23 00:18:27 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_NE:
|
2009-01-23 00:18:27 +00:00
|
|
|
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NE);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2009-01-23 00:18:27 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_SE:
|
2009-01-23 00:18:27 +00:00
|
|
|
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SE);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2009-01-23 00:18:27 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_SW:
|
2009-01-23 00:18:27 +00:00
|
|
|
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SW);
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2009-01-23 00:18:27 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_BORDERS_RANDOM:
|
2009-01-23 00:18:27 +00:00
|
|
|
_settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM;
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2009-01-21 02:31:55 +00:00
|
|
|
break;
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnTimeout() override
|
2009-08-16 16:48:59 +00:00
|
|
|
{
|
2014-09-21 12:25:04 +00:00
|
|
|
static const int raise_widgets[] = {WID_GL_MAX_HEIGHTLEVEL_DOWN, WID_GL_MAX_HEIGHTLEVEL_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WIDGET_LIST_END};
|
2009-08-16 16:48:59 +00:00
|
|
|
for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
|
|
|
|
if (this->IsWidgetLowered(*widget)) {
|
|
|
|
this->RaiseWidget(*widget);
|
2009-09-13 19:15:59 +00:00
|
|
|
this->SetWidgetDirty(*widget);
|
2009-08-16 16:48:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnDropdownSelect(int widget, int index) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
|
|
|
|
case WID_GL_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
|
|
|
|
case WID_GL_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break;
|
|
|
|
case WID_GL_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
|
|
|
|
case WID_GL_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break;
|
2014-10-13 14:22:48 +00:00
|
|
|
|
|
|
|
case WID_GL_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index;
|
|
|
|
/* If original landgenerator is selected and alpinist terrain_type was selected, revert to mountainous. */
|
|
|
|
if (_settings_newgame.game_creation.land_generator == LG_ORIGINAL) {
|
|
|
|
_settings_newgame.difficulty.terrain_type = Clamp(_settings_newgame.difficulty.terrain_type, 0, 3);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: _settings_newgame.game_creation.heightmap_rotation = index; break;
|
|
|
|
|
|
|
|
case WID_GL_TOWN_PULLDOWN:
|
2009-03-13 00:48:03 +00:00
|
|
|
if ((uint)index == CUSTOM_TOWN_NUMBER_DIFFICULTY) {
|
2009-03-12 23:54:20 +00:00
|
|
|
this->widget_id = widget;
|
|
|
|
SetDParam(0, _settings_newgame.game_creation.custom_town_number);
|
2011-04-17 18:42:17 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, this, CS_NUMERAL, QSF_NONE);
|
2011-01-15 15:36:58 +00:00
|
|
|
}
|
2014-09-21 14:45:35 +00:00
|
|
|
_settings_newgame.difficulty.number_towns = index;
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2021-01-12 22:02:16 +00:00
|
|
|
case WID_GL_TOWNNAME_DROPDOWN: // Town names
|
|
|
|
if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
|
|
|
|
_settings_newgame.game_creation.town_name = index;
|
|
|
|
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-09-21 14:45:35 +00:00
|
|
|
case WID_GL_INDUSTRY_PULLDOWN: _settings_newgame.difficulty.industry_density = index; break;
|
|
|
|
case WID_GL_TERRAIN_PULLDOWN: _settings_newgame.difficulty.terrain_type = index; break;
|
2008-05-11 12:26:20 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_PULLDOWN: {
|
2010-09-20 18:56:35 +00:00
|
|
|
if ((uint)index == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) {
|
|
|
|
this->widget_id = widget;
|
|
|
|
SetDParam(0, _settings_newgame.game_creation.custom_sea_level);
|
2011-04-17 18:42:17 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_QUANTITY_OF_SEA_LAKES, 3, this, CS_NUMERAL, QSF_NONE);
|
2011-01-15 15:36:58 +00:00
|
|
|
}
|
2014-09-21 14:45:35 +00:00
|
|
|
_settings_newgame.difficulty.quantity_sea_lakes = index;
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
2009-02-24 23:20:17 +00:00
|
|
|
}
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnQueryTextFinished(char *str) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
2010-01-23 15:53:09 +00:00
|
|
|
/* Was 'cancel' pressed? */
|
2019-04-10 21:07:06 +00:00
|
|
|
if (str == nullptr) return;
|
2010-01-23 15:53:09 +00:00
|
|
|
|
2009-12-21 16:16:37 +00:00
|
|
|
int32 value;
|
2008-05-11 12:26:20 +00:00
|
|
|
if (!StrEmpty(str)) {
|
2009-12-21 16:16:37 +00:00
|
|
|
value = atoi(str);
|
|
|
|
} else {
|
|
|
|
/* An empty string means revert to the default */
|
2008-05-11 12:26:20 +00:00
|
|
|
switch (this->widget_id) {
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_TEXT: value = DEF_MAX_HEIGHTLEVEL; break;
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_START_DATE_TEXT: value = DEF_START_YEAR; break;
|
|
|
|
case WID_GL_SNOW_LEVEL_TEXT: value = DEF_SNOWLINE_HEIGHT; break;
|
|
|
|
case WID_GL_TOWN_PULLDOWN: value = 1; break;
|
|
|
|
case WID_GL_WATER_PULLDOWN: value = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; break;
|
2009-12-21 16:16:37 +00:00
|
|
|
default: NOT_REACHED();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
2009-12-21 16:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (this->widget_id) {
|
2014-09-21 12:25:04 +00:00
|
|
|
case WID_GL_MAX_HEIGHTLEVEL_TEXT:
|
|
|
|
this->SetWidgetDirty(WID_GL_MAX_HEIGHTLEVEL_TEXT);
|
|
|
|
_settings_newgame.construction.max_heightlevel = Clamp(value, MIN_MAX_HEIGHTLEVEL, MAX_MAX_HEIGHTLEVEL);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_START_DATE_TEXT:
|
|
|
|
this->SetWidgetDirty(WID_GL_START_DATE_TEXT);
|
2009-12-21 16:16:37 +00:00
|
|
|
_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_SNOW_LEVEL_TEXT:
|
|
|
|
this->SetWidgetDirty(WID_GL_SNOW_LEVEL_TEXT);
|
2009-12-21 16:16:37 +00:00
|
|
|
_settings_newgame.game_creation.snow_line_height = Clamp(value, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
|
|
|
|
break;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_TOWN_PULLDOWN:
|
2009-12-21 16:16:37 +00:00
|
|
|
_settings_newgame.game_creation.custom_town_number = Clamp(value, 1, CUSTOM_TOWN_MAX_NUMBER);
|
|
|
|
break;
|
2010-09-20 18:56:35 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GL_WATER_PULLDOWN:
|
2010-09-20 18:56:35 +00:00
|
|
|
_settings_newgame.game_creation.custom_sea_level = Clamp(value, CUSTOM_SEA_LEVEL_MIN_PERCENTAGE, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE);
|
|
|
|
break;
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2009-12-21 16:16:37 +00:00
|
|
|
|
2010-05-21 08:23:46 +00:00
|
|
|
this->InvalidateData();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
2008-05-11 12:26:20 +00:00
|
|
|
};
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _generate_landscape_desc(
|
2019-04-10 21:07:06 +00:00
|
|
|
WDP_CENTER, nullptr, 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GENERATE_LANDSCAPE, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _heightmap_load_desc(
|
2019-04-10 21:07:06 +00:00
|
|
|
WDP_CENTER, nullptr, 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GENERATE_LANDSCAPE, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2015-02-08 21:05:48 +00:00
|
|
|
static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2007-06-28 10:50:26 +00:00
|
|
|
uint x = 0;
|
|
|
|
uint y = 0;
|
|
|
|
|
2007-02-01 23:39:48 +00:00
|
|
|
DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2014-04-27 15:15:28 +00:00
|
|
|
/* Generate a new seed when opening the window */
|
|
|
|
_settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2010-01-18 12:53:01 +00:00
|
|
|
if (mode == GLWM_HEIGHTMAP) {
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/* If the function returns negative, it means there was a problem loading the heightmap */
|
2020-12-06 20:11:45 +00:00
|
|
|
if (!GetHeightmapDimensions(_file_to_saveload.detail_ftype, _file_to_saveload.name.c_str(), &x, &y)) return;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2014-12-18 18:20:59 +00:00
|
|
|
WindowDesc *desc = (mode == GLWM_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc;
|
|
|
|
GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>(desc, mode, true);
|
2007-06-28 10:50:26 +00:00
|
|
|
|
2010-01-18 12:53:01 +00:00
|
|
|
if (mode == GLWM_HEIGHTMAP) {
|
2008-05-11 12:26:20 +00:00
|
|
|
w->x = x;
|
|
|
|
w->y = y;
|
|
|
|
strecpy(w->name, _file_to_saveload.title, lastof(w->name));
|
2007-06-28 10:50:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 17:42:12 +00:00
|
|
|
/** Start with a normal game. */
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowGenerateLandscape()
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2010-01-18 12:53:01 +00:00
|
|
|
_ShowGenerateLandscape(GLWM_GENERATE);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 17:42:12 +00:00
|
|
|
/** Start with loading a heightmap. */
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowHeightmapLoad()
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2010-01-18 12:53:01 +00:00
|
|
|
_ShowGenerateLandscape(GLWM_HEIGHTMAP);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 17:42:12 +00:00
|
|
|
/** Start with a scenario editor. */
|
2007-03-07 11:47:46 +00:00
|
|
|
void StartScenarioEditor()
|
2007-02-01 22:54:04 +00:00
|
|
|
{
|
2010-01-18 12:53:01 +00:00
|
|
|
StartGeneratingLandscape(GLWM_SCENARIO);
|
2007-02-01 22:54:04 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 17:42:12 +00:00
|
|
|
/**
|
|
|
|
* Start a normal game without the GUI.
|
|
|
|
* @param seed The seed of the new game.
|
|
|
|
*/
|
2018-10-10 23:33:37 +00:00
|
|
|
void StartNewGameWithoutGUI(uint32 seed)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
|
|
|
/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
|
2008-05-25 19:17:03 +00:00
|
|
|
_settings_newgame.game_creation.generation_seed = seed;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2010-01-18 12:53:01 +00:00
|
|
|
StartGeneratingLandscape(GLWM_GENERATE);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:26:20 +00:00
|
|
|
struct CreateScenarioWindow : public Window
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2008-05-11 12:26:20 +00:00
|
|
|
uint widget_id;
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
CreateScenarioWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(window_number);
|
2011-12-16 16:27:45 +00:00
|
|
|
this->LowerWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE);
|
2009-11-08 12:38:00 +00:00
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void SetStringParameters(int widget) const override
|
2009-11-08 12:38:00 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_START_DATE_TEXT:
|
2009-11-08 12:38:00 +00:00
|
|
|
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_X_PULLDOWN:
|
2018-06-10 13:36:55 +00:00
|
|
|
SetDParam(0, 1LL << _settings_newgame.game_creation.map_x);
|
2009-11-08 12:38:00 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_Y_PULLDOWN:
|
2018-06-10 13:36:55 +00:00
|
|
|
SetDParam(0, 1LL << _settings_newgame.game_creation.map_y);
|
2009-11-08 12:38:00 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_TEXT:
|
2009-11-08 12:38:00 +00:00
|
|
|
SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
|
|
|
|
break;
|
|
|
|
}
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnPaint() override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
|
|
|
|
this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
|
|
|
|
this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0);
|
|
|
|
this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT);
|
2008-05-11 12:26:20 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetLoweredState(WID_CS_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
|
|
|
|
this->SetWidgetLoweredState(WID_CS_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
|
|
|
|
this->SetWidgetLoweredState(WID_CS_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC);
|
|
|
|
this->SetWidgetLoweredState(WID_CS_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND);
|
2008-05-11 12:26:20 +00:00
|
|
|
|
2008-05-17 12:48:06 +00:00
|
|
|
this->DrawWidgets();
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
2009-11-08 12:38:00 +00:00
|
|
|
{
|
|
|
|
StringID str = STR_JUST_INT;
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_START_DATE_TEXT:
|
2009-11-08 12:38:00 +00:00
|
|
|
SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
|
|
|
|
str = STR_BLACK_DATE_LONG;
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_X_PULLDOWN:
|
|
|
|
case WID_CS_MAPSIZE_Y_PULLDOWN:
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, MAX_MAP_SIZE);
|
2009-11-08 12:38:00 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_TEXT:
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, MAX_TILE_HEIGHT);
|
2009-11-08 12:38:00 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2014-09-20 12:27:09 +00:00
|
|
|
*size = maxdim(*size, GetStringBoundingBox(str));
|
2009-11-08 12:38:00 +00:00
|
|
|
size->width += padding.width;
|
|
|
|
size->height += padding.height;
|
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_TEMPERATE:
|
|
|
|
case WID_CS_ARCTIC:
|
|
|
|
case WID_CS_TROPICAL:
|
|
|
|
case WID_CS_TOYLAND:
|
|
|
|
this->RaiseWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE);
|
|
|
|
SetNewLandscapeType(widget - WID_CS_TEMPERATE);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_X_PULLDOWN: // Mapsize X
|
|
|
|
ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_CS_MAPSIZE_X_PULLDOWN);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_Y_PULLDOWN: // Mapsize Y
|
|
|
|
ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_CS_MAPSIZE_Y_PULLDOWN);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_EMPTY_WORLD: // Empty world / flat world
|
2010-01-18 12:53:01 +00:00
|
|
|
StartGeneratingLandscape(GLWM_SCENARIO);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_RANDOM_WORLD: // Generate
|
2008-05-11 12:26:20 +00:00
|
|
|
ShowGenerateLandscape();
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_START_DATE_DOWN:
|
|
|
|
case WID_CS_START_DATE_UP: // Year buttons
|
2008-05-11 12:26:20 +00:00
|
|
|
/* Don't allow too fast scrolling */
|
2011-12-17 20:52:07 +00:00
|
|
|
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
|
2008-05-11 12:26:20 +00:00
|
|
|
this->HandleButtonClick(widget);
|
|
|
|
this->SetDirty();
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_CS_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
_left_button_clicked = false;
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_START_DATE_TEXT: // Year text
|
|
|
|
this->widget_id = WID_CS_START_DATE_TEXT;
|
2008-05-25 19:17:03 +00:00
|
|
|
SetDParam(0, _settings_newgame.game_creation.starting_year);
|
2011-04-17 18:42:17 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_NONE);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_DOWN:
|
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_UP: // Height level buttons
|
2008-05-11 12:26:20 +00:00
|
|
|
/* Don't allow too fast scrolling */
|
2011-12-17 20:52:07 +00:00
|
|
|
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
|
2008-05-11 12:26:20 +00:00
|
|
|
this->HandleButtonClick(widget);
|
|
|
|
this->SetDirty();
|
|
|
|
|
2014-09-27 09:53:48 +00:00
|
|
|
_settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - WID_CS_FLAT_LAND_HEIGHT_TEXT, 0, _settings_game.construction.max_heightlevel);
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
_left_button_clicked = false;
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_TEXT: // Height level text
|
|
|
|
this->widget_id = WID_CS_FLAT_LAND_HEIGHT_TEXT;
|
2008-05-25 19:17:03 +00:00
|
|
|
SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
|
2014-09-22 19:21:37 +00:00
|
|
|
ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_NONE);
|
2008-05-11 12:26:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnTimeout() override
|
2009-11-15 20:37:13 +00:00
|
|
|
{
|
2011-12-16 16:27:45 +00:00
|
|
|
static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END};
|
2009-11-15 20:37:13 +00:00
|
|
|
for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
|
|
|
|
if (this->IsWidgetLowered(*widget)) {
|
|
|
|
this->RaiseWidget(*widget);
|
|
|
|
this->SetWidgetDirty(*widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnDropdownSelect(int widget, int index) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
|
|
|
|
case WID_CS_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
|
2008-05-11 12:26:20 +00:00
|
|
|
}
|
|
|
|
this->SetDirty();
|
|
|
|
}
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnQueryTextFinished(char *str) override
|
2008-05-11 12:26:20 +00:00
|
|
|
{
|
|
|
|
if (!StrEmpty(str)) {
|
|
|
|
int32 value = atoi(str);
|
2008-01-18 21:33:19 +00:00
|
|
|
|
2008-05-11 12:26:20 +00:00
|
|
|
switch (this->widget_id) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_START_DATE_TEXT:
|
|
|
|
this->SetWidgetDirty(WID_CS_START_DATE_TEXT);
|
2008-05-25 19:17:03 +00:00
|
|
|
_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
|
2008-01-18 21:33:19 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_CS_FLAT_LAND_HEIGHT_TEXT:
|
|
|
|
this->SetWidgetDirty(WID_CS_FLAT_LAND_HEIGHT_TEXT);
|
2014-09-27 09:53:48 +00:00
|
|
|
_settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, _settings_game.construction.max_heightlevel);
|
2008-01-18 21:33:19 +00:00
|
|
|
break;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:26:20 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
2008-05-11 12:26:20 +00:00
|
|
|
};
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2009-03-30 20:02:16 +00:00
|
|
|
static const NWidgetPart _nested_create_scenario_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_SE_MAPGEN_CAPTION, STR_NULL),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_BROWN),
|
2009-03-30 20:02:16 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 10),
|
|
|
|
/* Landscape style selection. */
|
2009-11-08 12:38:00 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
|
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
|
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
|
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
2009-11-08 12:38:00 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 10),
|
2009-03-30 20:02:16 +00:00
|
|
|
/* Green generation type buttons: 'Flat land' and 'Random land'. */
|
2009-11-08 12:38:00 +00:00
|
|
|
NWidget(NWID_VERTICAL), SetPIP(10, 6, 10),
|
2012-11-11 16:09:08 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_CS_EMPTY_WORLD), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD, STR_SE_MAPGEN_FLAT_WORLD_TOOLTIP), SetFill(1, 1),
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_CS_RANDOM_WORLD), SetDataTip(STR_SE_MAPGEN_RANDOM_LAND, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetFill(1, 1),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Labels + setting drop-downs */
|
2009-11-08 12:38:00 +00:00
|
|
|
NWidget(NWID_VERTICAL), SetPIP(10, 6, 10),
|
2009-03-30 20:02:16 +00:00
|
|
|
/* Map size. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetPadding(1, 0, 0, 0),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetPadding(0, 4, 0, 0),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 2, 0, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Date. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetPadding(1, 0, 0, 0),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_START_DATE_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD),
|
2012-11-11 16:09:08 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CS_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_START_DATE_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Flat map height. */
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_TEXT, COLOUR_ORANGE),
|
2009-08-05 17:59:21 +00:00
|
|
|
SetDataTip(STR_SE_MAPGEN_FLAT_WORLD_HEIGHT, STR_NULL), SetPadding(1, 0, 0, 0),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_DOWN),
|
2012-11-11 16:09:08 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_UP),
|
2009-03-30 20:02:16 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _create_scenario_desc(
|
2019-04-10 21:07:06 +00:00
|
|
|
WDP_CENTER, nullptr, 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GENERATE_LANDSCAPE, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2011-05-02 17:42:12 +00:00
|
|
|
/** Show the window to create a scenario. */
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowCreateScenario()
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
|
|
|
DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
|
2010-01-18 12:53:01 +00:00
|
|
|
new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2009-03-28 16:35:33 +00:00
|
|
|
static const NWidgetPart _nested_generate_progress_widgets[] = {
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY),
|
2009-11-08 12:11:38 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
|
|
|
|
NWidget(NWID_VERTICAL), SetPIP(11, 8, 11),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_BAR), SetFill(1, 0),
|
|
|
|
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_TEXT), SetFill(1, 0),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_WHITE, WID_GP_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0),
|
2009-11-08 12:11:38 +00:00
|
|
|
EndContainer(),
|
2009-03-28 16:35:33 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _generate_progress_desc(
|
2019-04-10 21:07:06 +00:00
|
|
|
WDP_CENTER, nullptr, 0, 0,
|
2011-08-21 12:49:14 +00:00
|
|
|
WC_MODAL_PROGRESS, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_generate_progress_widgets, lengthof(_nested_generate_progress_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2008-05-17 03:16:04 +00:00
|
|
|
|
2010-01-17 22:59:24 +00:00
|
|
|
struct GenWorldStatus {
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
uint percent;
|
2007-01-10 18:56:51 +00:00
|
|
|
StringID cls;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
uint current;
|
|
|
|
uint total;
|
2021-02-19 18:31:45 +00:00
|
|
|
std::chrono::steady_clock::time_point next_update;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2010-01-17 22:59:24 +00:00
|
|
|
static GenWorldStatus _gws;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2010-01-17 22:59:24 +00:00
|
|
|
static const StringID _generation_class_table[] = {
|
2009-11-08 12:11:38 +00:00
|
|
|
STR_GENERATION_WORLD_GENERATION,
|
|
|
|
STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION,
|
2011-08-20 14:15:40 +00:00
|
|
|
STR_GENERATION_RIVER_GENERATION,
|
2009-11-08 12:11:38 +00:00
|
|
|
STR_GENERATION_CLEARING_TILES,
|
|
|
|
STR_SCENEDIT_TOOLBAR_TOWN_GENERATION,
|
|
|
|
STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION,
|
2010-08-08 10:59:30 +00:00
|
|
|
STR_GENERATION_OBJECT_GENERATION,
|
2009-11-08 12:11:38 +00:00
|
|
|
STR_GENERATION_TREE_GENERATION,
|
|
|
|
STR_GENERATION_SETTINGUP_GAME,
|
|
|
|
STR_GENERATION_PREPARING_TILELOOP,
|
2011-12-19 20:56:50 +00:00
|
|
|
STR_GENERATION_PREPARING_SCRIPT,
|
2009-11-08 12:11:38 +00:00
|
|
|
STR_GENERATION_PREPARING_GAME
|
|
|
|
};
|
2020-12-27 10:44:22 +00:00
|
|
|
static_assert(lengthof(_generation_class_table) == GWP_CLASS_COUNT);
|
2009-11-08 12:11:38 +00:00
|
|
|
|
|
|
|
|
2006-12-29 17:54:47 +00:00
|
|
|
static void AbortGeneratingWorldCallback(Window *w, bool confirmed)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2006-12-29 17:54:47 +00:00
|
|
|
if (confirmed) {
|
|
|
|
AbortGeneratingWorld();
|
2011-08-21 12:46:46 +00:00
|
|
|
} else if (HasModalProgress() && !IsGeneratingWorldAborted()) {
|
2007-01-14 19:57:49 +00:00
|
|
|
SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
|
2006-12-29 17:54:47 +00:00
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 03:16:04 +00:00
|
|
|
struct GenerateProgressWindow : public Window {
|
2009-03-28 16:35:33 +00:00
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
GenerateProgressWindow() : Window(&_generate_progress_desc)
|
2008-05-23 23:02:13 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested();
|
2008-05-23 23:02:13 +00:00
|
|
|
}
|
2008-05-17 03:16:04 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
2008-05-17 03:16:04 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GP_ABORT:
|
2016-08-15 18:32:48 +00:00
|
|
|
SetMouseCursorBusy(false);
|
2008-05-17 03:16:04 +00:00
|
|
|
ShowQuery(
|
|
|
|
STR_GENERATION_ABORT_CAPTION,
|
|
|
|
STR_GENERATION_ABORT_MESSAGE,
|
|
|
|
this,
|
|
|
|
AbortGeneratingWorldCallback
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
2009-11-08 12:11:38 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GP_PROGRESS_BAR: {
|
2012-12-08 17:18:51 +00:00
|
|
|
SetDParamMaxValue(0, 100);
|
2009-11-08 12:11:38 +00:00
|
|
|
*size = GetStringBoundingBox(STR_GENERATION_PROGRESS);
|
|
|
|
/* We need some spacing for the 'border' */
|
|
|
|
size->height += 8;
|
|
|
|
size->width += 8;
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-11-08 12:11:38 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GP_PROGRESS_TEXT:
|
2009-11-08 12:11:38 +00:00
|
|
|
for (uint i = 0; i < GWP_CLASS_COUNT; i++) {
|
2021-01-08 10:16:18 +00:00
|
|
|
size->width = std::max(size->width, GetStringBoundingBox(_generation_class_table[i]).width);
|
2009-11-08 12:11:38 +00:00
|
|
|
}
|
|
|
|
size->height = FONT_HEIGHT_NORMAL * 2 + WD_PAR_VSEP_NORMAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void DrawWidget(const Rect &r, int widget) const override
|
2009-11-08 12:11:38 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GP_PROGRESS_BAR:
|
2009-11-08 12:11:38 +00:00
|
|
|
/* Draw the % complete with a bar and a text */
|
|
|
|
DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY);
|
2010-01-17 22:59:24 +00:00
|
|
|
DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * _gws.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE);
|
|
|
|
SetDParam(0, _gws.percent);
|
2010-07-02 13:53:05 +00:00
|
|
|
DrawString(r.left, r.right, r.top + 5, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
|
2009-11-08 12:11:38 +00:00
|
|
|
break;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_GP_PROGRESS_TEXT:
|
2009-11-08 12:11:38 +00:00
|
|
|
/* Tell which class we are generating */
|
2010-07-02 13:53:05 +00:00
|
|
|
DrawString(r.left, r.right, r.top, _gws.cls, TC_FROMSTRING, SA_HOR_CENTER);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2009-11-08 12:11:38 +00:00
|
|
|
/* And say where we are in that class */
|
2010-01-17 22:59:24 +00:00
|
|
|
SetDParam(0, _gws.current);
|
|
|
|
SetDParam(1, _gws.total);
|
2010-07-02 13:53:05 +00:00
|
|
|
DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL, STR_GENERATION_PROGRESS_NUM, TC_FROMSTRING, SA_HOR_CENTER);
|
2009-11-08 12:11:38 +00:00
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the progress counters to the starting point.
|
|
|
|
*/
|
2007-03-07 11:47:46 +00:00
|
|
|
void PrepareGenerateWorldProgress()
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2021-02-19 18:31:45 +00:00
|
|
|
_gws.cls = STR_GENERATION_WORLD_GENERATION;
|
2010-01-17 22:59:24 +00:00
|
|
|
_gws.current = 0;
|
2021-02-19 18:31:45 +00:00
|
|
|
_gws.total = 0;
|
2010-01-17 22:59:24 +00:00
|
|
|
_gws.percent = 0;
|
2021-02-19 18:31:45 +00:00
|
|
|
_gws.next_update = std::chrono::steady_clock::now();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the window where a user can follow the process of the map generation.
|
|
|
|
*/
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowGenerateWorldProgress()
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2011-08-21 12:49:14 +00:00
|
|
|
if (BringWindowToFrontById(WC_MODAL_PROGRESS, 0)) return;
|
2008-05-17 03:16:04 +00:00
|
|
|
new GenerateProgressWindow();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2010-01-17 22:59:24 +00:00
|
|
|
static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uint total)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
2011-12-19 20:56:50 +00:00
|
|
|
static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 95, 99, 100 };
|
2020-12-27 10:44:22 +00:00
|
|
|
static_assert(lengthof(percent_table) == GWP_CLASS_COUNT + 1);
|
2007-01-10 18:56:51 +00:00
|
|
|
assert(cls < GWP_CLASS_COUNT);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2021-03-25 10:57:28 +00:00
|
|
|
/* Check if we really are generating the world.
|
|
|
|
* For example, placing trees via the SE also calls this function, but
|
|
|
|
* shouldn't try to update the progress.
|
|
|
|
*/
|
|
|
|
if (!HasModalProgress()) return;
|
|
|
|
|
2021-03-09 13:53:51 +00:00
|
|
|
if (IsGeneratingWorldAborted()) {
|
|
|
|
HandleGeneratingWorldAbortion();
|
|
|
|
return;
|
|
|
|
}
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
if (total == 0) {
|
2010-01-17 22:59:24 +00:00
|
|
|
assert(_gws.cls == _generation_class_table[cls]);
|
|
|
|
_gws.current += progress;
|
|
|
|
assert(_gws.current <= _gws.total);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
} else {
|
2010-01-17 22:59:24 +00:00
|
|
|
_gws.cls = _generation_class_table[cls];
|
|
|
|
_gws.current = progress;
|
|
|
|
_gws.total = total;
|
|
|
|
_gws.percent = percent_table[cls];
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Percentage is about the number of completed tasks, so 'current - 1' */
|
2010-01-17 22:59:24 +00:00
|
|
|
_gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
if (_network_dedicated) {
|
|
|
|
static uint last_percent = 0;
|
|
|
|
|
|
|
|
/* Never display 0% */
|
2010-01-17 22:59:24 +00:00
|
|
|
if (_gws.percent == 0) return;
|
2008-08-20 01:38:12 +00:00
|
|
|
/* Reset if percent is lower than the last recorded */
|
2010-01-17 22:59:24 +00:00
|
|
|
if (_gws.percent < last_percent) last_percent = 0;
|
2008-08-20 01:38:12 +00:00
|
|
|
/* Display every 5%, but 6% is also very valid.. just not smaller steps than 5% */
|
2010-01-17 22:59:24 +00:00
|
|
|
if (_gws.percent % 5 != 0 && _gws.percent <= last_percent + 5) return;
|
2008-08-20 01:38:12 +00:00
|
|
|
/* Never show steps smaller than 2%, even if it is a mod 5% */
|
2010-01-17 22:59:24 +00:00
|
|
|
if (_gws.percent <= last_percent + 2) return;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
2010-01-17 22:59:24 +00:00
|
|
|
DEBUG(net, 1, "Map generation percentage complete: %d", _gws.percent);
|
|
|
|
last_percent = _gws.percent;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-08-21 12:49:14 +00:00
|
|
|
SetWindowDirty(WC_MODAL_PROGRESS, 0);
|
2021-03-09 13:53:51 +00:00
|
|
|
|
|
|
|
VideoDriver::GetInstance()->GameLoopPause();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the total of a stage of the world generation.
|
2007-04-17 20:23:13 +00:00
|
|
|
* @param cls the current class we are in.
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
* @param 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.
|
|
|
|
*/
|
2010-01-17 22:59:24 +00:00
|
|
|
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
|
|
|
if (total == 0) return;
|
|
|
|
|
2007-01-10 18:56:51 +00:00
|
|
|
_SetGeneratingWorldProgress(cls, 0, total);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Increases the current stage of the world generation with one.
|
2007-04-17 20:23:13 +00:00
|
|
|
* @param cls the current class we are in.
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2010-01-17 22:59:24 +00:00
|
|
|
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
{
|
|
|
|
/* In fact the param 'class' isn't needed.. but for some security reasons, we want it around */
|
2007-01-10 18:56:51 +00:00
|
|
|
_SetGeneratingWorldProgress(cls, 1, 0);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|