@@ -361,12 +361,17 @@ struct GenerateLandscapeWindow : public
this->SetFocusedWidget(GLAND_RANDOM_EDITBOX);
this->caption = STR_NULL;
this->afilter = CS_NUMERAL;
this->mode = (GenenerateLandscapeWindowMode)this->window_number;
/* Disable town, industry and trees in SE */
this->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR);
this->OnInvalidateData();
}
virtual void SetStringParameters(int widget) const
{
@@ -406,12 +411,40 @@ struct GenerateLandscapeWindow : public
/* Update the climate buttons */
this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
this->SetWidgetLoweredState(GLAND_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC);
this->SetWidgetLoweredState(GLAND_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND);
/* You can't select smoothness / non-water borders if not terragenesis */
if (mode == GLWM_GENERATE) {
this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges);
this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM,
GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW, WIDGET_LIST_END);
this->SetWidgetLoweredState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM);
this->SetWidgetLoweredState(GLAND_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW));
this->SetWidgetLoweredState(GLAND_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE));
this->SetWidgetLoweredState(GLAND_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE));
this->SetWidgetLoweredState(GLAND_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW));
this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC),
GLAND_TERRAIN_PULLDOWN, GLAND_WATER_PULLDOWN, WIDGET_LIST_END);
/* Disable snowline if not arctic */
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC);
/* Update availability of decreasing / increasing start date and snow level */
this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
const StringID *strs = NULL;
switch (widget) {
@@ -487,55 +520,23 @@ struct GenerateLandscapeWindow : public
} break;
virtual void OnPaint()
/* Disable snowline if not hilly */
this->DrawWidgets();
this->DrawEditBox(GLAND_RANDOM_EDITBOX);
virtual void OnClick(Point pt, int widget, int click_count)
case GLAND_TEMPERATE:
case GLAND_ARCTIC:
case GLAND_TROPICAL:
case GLAND_TOYLAND:
this->RaiseWidget(_settings_newgame.game_creation.landscape + GLAND_TEMPERATE);
SetNewLandscapeType(widget - GLAND_TEMPERATE);
break;
case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X
ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, GLAND_MAPSIZE_X_PULLDOWN);
@@ -579,15 +580,15 @@ struct GenerateLandscapeWindow : public
case GLAND_START_DATE_DOWN:
case GLAND_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
this->InvalidateData();
_left_button_clicked = false;
case GLAND_START_DATE_TEXT: // Year text
this->widget_id = GLAND_START_DATE_TEXT;
@@ -597,15 +598,15 @@ struct GenerateLandscapeWindow : public
case GLAND_SNOW_LEVEL_DOWN:
case GLAND_SNOW_LEVEL_UP: // Snow line buttons
_settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
case GLAND_SNOW_LEVEL_TEXT: // Snow line text
this->widget_id = GLAND_SNOW_LEVEL_TEXT;
@@ -641,29 +642,33 @@ struct GenerateLandscapeWindow : public
ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, GLAND_VARIETY_PULLDOWN, 0, 0);
/* Freetype map borders */
case GLAND_WATER_NW:
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NW);
case GLAND_WATER_NE:
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NE);
case GLAND_WATER_SE:
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SE);
case GLAND_WATER_SW:
_settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SW);
case GLAND_BORDERS_RANDOM:
_settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM;
virtual void OnTimeout()
@@ -730,13 +735,13 @@ struct GenerateLandscapeWindow : public
_game_mode = GM_MENU;
IConsoleSetSetting("difficulty.quantity_sea_lakes", index);
_game_mode = old_gm;
virtual void OnQueryTextFinished(char *str)
/* Was 'cancel' pressed? */
if (str == NULL) return;
@@ -766,27 +771,27 @@ struct GenerateLandscapeWindow : public
case GLAND_TOWN_PULLDOWN:
_settings_newgame.game_creation.custom_town_number = Clamp(value, 1, CUSTOM_TOWN_MAX_NUMBER);
};
static const WindowDesc _generate_landscape_desc(
WDP_CENTER, 0, 0,
WC_GENERATE_LANDSCAPE, WC_NONE,
WDF_UNCLICK_BUTTONS,
0,
_nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)
);
static const WindowDesc _heightmap_load_desc(
_nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)
static void _ShowGenerateLandscape(GenenerateLandscapeWindowMode mode)
uint x = 0;
Status change: