Changeset - r25078:95767d321ffb
[Not reviewed]
master
0 3 0
Patric Stout - 4 years ago 2021-03-24 08:37:51
truebrain@openttd.org
Change: remove "maximum map height" from the New Game GUI

This setting influence the max heightlevel, and not as the name
suggests: the height of the generated map.

How ever you slice it, it is a very weird place to add this
setting, and it is better off being only in the settings menu.

Commits following this commit also make it more useful, so users
no longer have to care about it.
3 files changed with 1 insertions and 54 deletions:
0 comments (0 inline, 0 general)
src/genworld_gui.cpp
Show inline comments
 
@@ -110,7 +110,6 @@ static const NWidgetPart _nested_generat
 
			NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
 
				NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
 
					NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
 
						NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GL_CLIMATE_SEL_LABEL),
 
							NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_COVERAGE, STR_NULL), SetFill(1, 1),
 
							NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DESERT_COVERAGE, STR_NULL), SetFill(1, 1),
 
@@ -121,12 +120,6 @@ static const NWidgetPart _nested_generat
 
						NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
 
					EndContainer(),
 
					NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
 
						/* Max. heightlevel. */
 
						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(),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GL_CLIMATE_SEL_SELECTOR),
 
							/* Snow coverage. */
 
							NWidget(NWID_HORIZONTAL),
 
@@ -238,7 +231,6 @@ static const NWidgetPart _nested_heightm
 
					NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
 
						NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
 
							NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
 
								NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
 
								NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GL_CLIMATE_SEL_LABEL),
 
									NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_COVERAGE, STR_NULL), SetFill(1, 1),
 
									NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DESERT_COVERAGE, STR_NULL), SetFill(1, 1),
 
@@ -247,11 +239,6 @@ static const NWidgetPart _nested_heightm
 
								NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
 
							EndContainer(),
 
							NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
 
								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(),
 
								NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GL_CLIMATE_SEL_SELECTOR),
 
									NWidget(NWID_HORIZONTAL),
 
										NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_COVERAGE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_COVERAGE_DOWN), SetFill(0, 1),
 
@@ -386,7 +373,6 @@ struct GenerateLandscapeWindow : public 
 
			case WID_GL_START_DATE_TEXT:      SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break;
 
			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;
 
			case WID_GL_MAX_HEIGHTLEVEL_TEXT: SetDParam(0, _settings_newgame.construction.max_heightlevel); break;
 
			case WID_GL_SNOW_COVERAGE_TEXT:   SetDParam(0, _settings_newgame.game_creation.snow_coverage); break;
 
			case WID_GL_DESERT_COVERAGE_TEXT: SetDParam(0, _settings_newgame.game_creation.desert_coverage); break;
 

	
 
@@ -495,8 +481,6 @@ struct GenerateLandscapeWindow : public 
 
		this->GetWidget<NWidgetStacked>(WID_GL_CLIMATE_SEL_SELECTOR)->SetDisplayedPlane(climate_plane);
 

	
 
		/* Update availability of decreasing / increasing start date and snow level */
 
		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);
 
		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_COVERAGE_DOWN, _settings_newgame.game_creation.snow_coverage <= 0 || _settings_newgame.game_creation.landscape != LT_ARCTIC);
 
@@ -516,11 +500,6 @@ struct GenerateLandscapeWindow : public 
 
	{
 
		const StringID *strs = nullptr;
 
		switch (widget) {
 
			case WID_GL_MAX_HEIGHTLEVEL_TEXT:
 
				SetDParam(0, MAX_TILE_HEIGHT);
 
				*size = GetStringBoundingBox(STR_JUST_INT);
 
				break;
 

	
 
			case WID_GL_START_DATE_TEXT:
 
				SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
 
				*size = maxdim(*size, GetStringBoundingBox(STR_BLACK_DATE_LONG));
 
@@ -661,25 +640,6 @@ struct GenerateLandscapeWindow : public 
 
				break;
 
			}
 

	
 
			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;
 

	
 

	
 
			case WID_GL_START_DATE_DOWN:
 
			case WID_GL_START_DATE_UP: // Year buttons
 
				/* Don't allow too fast scrolling */
 
@@ -799,7 +759,7 @@ struct GenerateLandscapeWindow : public 
 

	
 
	void OnTimeout() override
 
	{
 
		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_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WIDGET_LIST_END};
 
		static const int raise_widgets[] = {WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WIDGET_LIST_END};
 
		for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
 
			if (this->IsWidgetLowered(*widget)) {
 
				this->RaiseWidget(*widget);
 
@@ -869,7 +829,6 @@ struct GenerateLandscapeWindow : public 
 
		} else {
 
			/* An empty string means revert to the default */
 
			switch (this->widget_id) {
 
				case WID_GL_MAX_HEIGHTLEVEL_TEXT: value = DEF_MAX_HEIGHTLEVEL; break;
 
				case WID_GL_START_DATE_TEXT: value = DEF_START_YEAR; break;
 
				case WID_GL_SNOW_COVERAGE_TEXT: value = DEF_SNOW_COVERAGE; break;
 
				case WID_GL_DESERT_COVERAGE_TEXT: value = DEF_DESERT_COVERAGE; break;
 
@@ -880,11 +839,6 @@ struct GenerateLandscapeWindow : public 
 
		}
 

	
 
		switch (this->widget_id) {
 
			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;
 

	
 
			case WID_GL_START_DATE_TEXT:
 
				this->SetWidgetDirty(WID_GL_START_DATE_TEXT);
 
				_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
src/lang/english.txt
Show inline comments
 
@@ -2898,9 +2898,6 @@ STR_MAPGEN_BY                           
 
STR_MAPGEN_NUMBER_OF_TOWNS                                      :{BLACK}No. of towns:
 
STR_MAPGEN_DATE                                                 :{BLACK}Date:
 
STR_MAPGEN_NUMBER_OF_INDUSTRIES                                 :{BLACK}No. of industries:
 
STR_MAPGEN_MAX_HEIGHTLEVEL                                      :{BLACK}Maximum map height:
 
STR_MAPGEN_MAX_HEIGHTLEVEL_UP                                   :{BLACK}Increase the maximum height of mountains on the map by one
 
STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN                                 :{BLACK}Decrease the maximum height of mountains on the map by one
 
STR_MAPGEN_SNOW_COVERAGE                                        :{BLACK}Snow coverage:
 
STR_MAPGEN_SNOW_COVERAGE_UP                                     :{BLACK}Increase snow coverage by ten percent
 
STR_MAPGEN_SNOW_COVERAGE_DOWN                                   :{BLACK}Decrease snow coverage by ten percent
src/widgets/genworld_widget.h
Show inline comments
 
@@ -26,10 +26,6 @@ enum GenerateLandscapeWidgets {
 

	
 
	WID_GL_GENERATE_BUTTON,             ///< 'Generate' button.
 

	
 
	WID_GL_MAX_HEIGHTLEVEL_DOWN,        ///< Decrease max. heightlevel
 
	WID_GL_MAX_HEIGHTLEVEL_TEXT,        ///< Max. heightlevel
 
	WID_GL_MAX_HEIGHTLEVEL_UP,          ///< Increase max. heightlevel
 

	
 
	WID_GL_START_DATE_DOWN,             ///< Decrease start year.
 
	WID_GL_START_DATE_TEXT,             ///< Start year.
 
	WID_GL_START_DATE_UP,               ///< Increase start year.
0 comments (0 inline, 0 general)