@ -111,7 +111,10 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
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 ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_SNOW_COVERAGE , 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 ) ,
EndContainer ( ) ,
NWidget ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_DATE , STR_NULL ) , SetFill ( 1 , 1 ) ,
NWidget ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_SMOOTHNESS , STR_NULL ) , SetFill ( 1 , 1 ) ,
NWidget ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_QUANTITY_OF_RIVERS , STR_NULL ) , SetFill ( 1 , 1 ) ,
@ -124,11 +127,19 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
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 ( ) ,
/* Snow line. */
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 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_TEXT ) , SetDataTip ( STR_MAPGEN_SNOW_COVERAGE_TEXT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_SNOW_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
NWidget ( NWID_SELECTION , INVALID_COLOUR , WID_GL_CLIMATE_SEL_SELECTOR ) ,
/* Snow coverage. */
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 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_TEXT ) , SetDataTip ( STR_MAPGEN_SNOW_COVERAGE_TEXT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_SNOW_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
EndContainer ( ) ,
/* Desert coverage. */
NWidget ( NWID_HORIZONTAL ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_DOWN ) , SetDataTip ( SPR_ARROW_DOWN , STR_MAPGEN_DESERT_COVERAGE_DOWN ) , SetFill ( 0 , 1 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_TEXT ) , SetDataTip ( STR_MAPGEN_DESERT_COVERAGE_TEXT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_DESERT_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
EndContainer ( ) ,
EndContainer ( ) ,
/* Starting date. */
NWidget ( NWID_HORIZONTAL ) ,
@ -228,7 +239,10 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
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 ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_SNOW_COVERAGE , 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 ) ,
EndContainer ( ) ,
NWidget ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_MAPGEN_DATE , STR_NULL ) , SetFill ( 1 , 1 ) ,
NWidget ( WWT_TEXT , COLOUR_ORANGE ) , SetDataTip ( STR_GAME_OPTIONS_TOWN_NAMES_FRAME , STR_NULL ) , SetFill ( 1 , 1 ) ,
EndContainer ( ) ,
@ -238,10 +252,17 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
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_HORIZONTAL ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_DOWN ) , SetDataTip ( SPR_ARROW_DOWN , STR_MAPGEN_SNOW_COVERAGE_DOWN ) , SetFill ( 0 , 1 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_TEXT ) , SetDataTip ( STR_BLACK_INT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_SNOW_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
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 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_TEXT ) , SetDataTip ( STR_MAPGEN_SNOW_COVERAGE_TEXT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_SNOW_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_SNOW_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
EndContainer ( ) ,
NWidget ( NWID_HORIZONTAL ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_DOWN ) , SetDataTip ( SPR_ARROW_DOWN , STR_MAPGEN_DESERT_COVERAGE_DOWN ) , SetFill ( 0 , 1 ) ,
NWidget ( WWT_TEXTBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_TEXT ) , SetDataTip ( STR_MAPGEN_DESERT_COVERAGE_TEXT , STR_NULL ) , SetFill ( 1 , 0 ) ,
NWidget ( WWT_IMGBTN , COLOUR_ORANGE , WID_GL_DESERT_COVERAGE_UP ) , SetDataTip ( SPR_ARROW_UP , STR_MAPGEN_DESERT_COVERAGE_UP ) , SetFill ( 0 , 1 ) ,
EndContainer ( ) ,
EndContainer ( ) ,
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 ) ,
@ -367,6 +388,7 @@ struct GenerateLandscapeWindow : public Window {
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 ;
case WID_GL_TOWN_PULLDOWN :
if ( _game_mode = = GM_EDITOR ) {
@ -458,6 +480,19 @@ struct GenerateLandscapeWindow : public Window {
/* Disable snowline if not arctic */
this - > SetWidgetDisabledState ( WID_GL_SNOW_COVERAGE_TEXT , _settings_newgame . game_creation . landscape ! = LT_ARCTIC ) ;
/* Disable desert if not tropic */
this - > SetWidgetDisabledState ( WID_GL_DESERT_COVERAGE_TEXT , _settings_newgame . game_creation . landscape ! = LT_TROPIC ) ;
/* Set snow/rainforest selections */
int climate_plane = 0 ;
switch ( _settings_newgame . game_creation . landscape ) {
case LT_TEMPERATE : climate_plane = SZSP_VERTICAL ; break ;
case LT_ARCTIC : climate_plane = 0 ; break ;
case LT_TROPIC : climate_plane = 1 ; break ;
case LT_TOYLAND : climate_plane = SZSP_VERTICAL ; break ;
}
this - > GetWidget < NWidgetStacked > ( WID_GL_CLIMATE_SEL_LABEL ) - > SetDisplayedPlane ( climate_plane ) ;
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 ) ;
@ -466,6 +501,8 @@ struct GenerateLandscapeWindow : public Window {
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 ) ;
this - > SetWidgetDisabledState ( WID_GL_SNOW_COVERAGE_UP , _settings_newgame . game_creation . snow_coverage > = 100 | | _settings_newgame . game_creation . landscape ! = LT_ARCTIC ) ;
this - > SetWidgetDisabledState ( WID_GL_DESERT_COVERAGE_DOWN , _settings_newgame . game_creation . desert_coverage < = 0 | | _settings_newgame . game_creation . landscape ! = LT_TROPIC ) ;
this - > SetWidgetDisabledState ( WID_GL_DESERT_COVERAGE_UP , _settings_newgame . game_creation . desert_coverage > = 100 | | _settings_newgame . game_creation . landscape ! = LT_TROPIC ) ;
/* Do not allow a custom sea level with the original land generator. */
if ( _settings_newgame . game_creation . land_generator = = LG_ORIGINAL & &
@ -500,6 +537,11 @@ struct GenerateLandscapeWindow : public Window {
* size = maxdim ( * size , GetStringBoundingBox ( STR_MAPGEN_SNOW_COVERAGE_TEXT ) ) ;
break ;
case WID_GL_DESERT_COVERAGE_TEXT :
SetDParamMaxValue ( 0 , MAX_TILE_HEIGHT ) ;
* size = maxdim ( * size , GetStringBoundingBox ( STR_MAPGEN_DESERT_COVERAGE_TEXT ) ) ;
break ;
case WID_GL_HEIGHTMAP_SIZE_TEXT :
SetDParam ( 0 , this - > x ) ;
SetDParam ( 1 , this - > y ) ;
@ -674,6 +716,24 @@ struct GenerateLandscapeWindow : public Window {
ShowQueryString ( STR_JUST_INT , STR_MAPGEN_SNOW_COVERAGE_QUERY_CAPT , 4 , this , CS_NUMERAL , QSF_ENABLE_DEFAULT ) ;
break ;
case WID_GL_DESERT_COVERAGE_DOWN :
case WID_GL_DESERT_COVERAGE_UP : // Desert coverage buttons
/* Don't allow too fast scrolling */
if ( ! ( this - > flags & WF_TIMEOUT ) | | this - > timeout_timer < = 1 ) {
this - > HandleButtonClick ( widget ) ;
_settings_newgame . game_creation . desert_coverage = Clamp ( _settings_newgame . game_creation . desert_coverage + ( widget - WID_GL_DESERT_COVERAGE_TEXT ) * 10 , 0 , 100 ) ;
this - > InvalidateData ( ) ;
}
_left_button_clicked = false ;
break ;
case WID_GL_DESERT_COVERAGE_TEXT : // Desert line text
this - > widget_id = WID_GL_DESERT_COVERAGE_TEXT ;
SetDParam ( 0 , _settings_newgame . game_creation . desert_coverage ) ;
ShowQueryString ( STR_JUST_INT , STR_MAPGEN_DESERT_COVERAGE_QUERY_CAPT , 4 , this , CS_NUMERAL , QSF_ENABLE_DEFAULT ) ;
break ;
case WID_GL_LANDSCAPE_PULLDOWN : // Landscape generator
ShowDropDownMenu ( this , _landscape , _settings_newgame . game_creation . land_generator , WID_GL_LANDSCAPE_PULLDOWN , 0 , 0 ) ;
break ;
@ -739,7 +799,7 @@ struct GenerateLandscapeWindow : public Window {
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 GET_LIST_END} ;
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 , WID GET_LIST_END} ;
for ( const int * widget = raise_widgets ; * widget ! = WIDGET_LIST_END ; widget + + ) {
if ( this - > IsWidgetLowered ( * widget ) ) {
this - > RaiseWidget ( * widget ) ;
@ -812,6 +872,7 @@ struct GenerateLandscapeWindow : public Window {
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 ;
case WID_GL_TOWN_PULLDOWN : value = 1 ; break ;
case WID_GL_WATER_PULLDOWN : value = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE ; break ;
default : NOT_REACHED ( ) ;
@ -834,6 +895,11 @@ struct GenerateLandscapeWindow : public Window {
_settings_newgame . game_creation . snow_coverage = Clamp ( value , 0 , 100 ) ;
break ;
case WID_GL_DESERT_COVERAGE_TEXT :
this - > SetWidgetDirty ( WID_GL_DESERT_COVERAGE_TEXT ) ;
_settings_newgame . game_creation . desert_coverage = Clamp ( value , 0 , 100 ) ;
break ;
case WID_GL_TOWN_PULLDOWN :
_settings_newgame . game_creation . custom_town_number = Clamp ( value , 1 , CUSTOM_TOWN_MAX_NUMBER ) ;
break ;