Codechange: Pass raw string to editable query window. (#13481)

This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
This commit is contained in:
Peter Nelson
2025-02-07 17:03:53 +00:00
committed by GitHub
parent 8c48f9fc49
commit c3643e3ee0
25 changed files with 60 additions and 115 deletions

View File

@@ -737,8 +737,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_HEIGHTMAP_HEIGHT_TEXT: // Height level text
this->widget_id = WID_GL_HEIGHTMAP_HEIGHT_TEXT;
SetDParam(0, _settings_newgame.game_creation.heightmap_height);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_HEIGHTMAP_HEIGHT_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.heightmap_height), STR_MAPGEN_HEIGHTMAP_HEIGHT_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
break;
@@ -756,8 +755,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_START_DATE_TEXT: // Year text
this->widget_id = WID_GL_START_DATE_TEXT;
SetDParam(0, _settings_newgame.game_creation.starting_year);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.starting_year), STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
break;
case WID_GL_SNOW_COVERAGE_DOWN:
@@ -774,8 +772,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_SNOW_COVERAGE_TEXT: // Snow coverage text
this->widget_id = WID_GL_SNOW_COVERAGE_TEXT;
SetDParam(0, _settings_newgame.game_creation.snow_coverage);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_COVERAGE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.snow_coverage), STR_MAPGEN_SNOW_COVERAGE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
break;
case WID_GL_DESERT_COVERAGE_DOWN:
@@ -792,8 +789,7 @@ struct GenerateLandscapeWindow : public Window {
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);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.desert_coverage), STR_MAPGEN_DESERT_COVERAGE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
break;
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation
@@ -890,8 +886,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_TOWN_PULLDOWN:
if ((uint)index == CUSTOM_TOWN_NUMBER_DIFFICULTY) {
this->widget_id = widget;
SetDParam(0, _settings_newgame.game_creation.custom_town_number);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.custom_town_number), STR_MAPGEN_NUMBER_OF_TOWNS, 5, this, CS_NUMERAL, QSF_NONE);
}
_settings_newgame.difficulty.number_towns = index;
break;
@@ -906,8 +901,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_INDUSTRY_PULLDOWN:
if ((uint)index == ID_CUSTOM) {
this->widget_id = widget;
SetDParam(0, _settings_newgame.game_creation.custom_industry_number);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_INDUSTRIES, 5, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.custom_industry_number), STR_MAPGEN_NUMBER_OF_INDUSTRIES, 5, this, CS_NUMERAL, QSF_NONE);
}
_settings_newgame.difficulty.industry_density = index;
break;
@@ -915,8 +909,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_TERRAIN_PULLDOWN: {
if ((uint)index == CUSTOM_TERRAIN_TYPE_NUMBER_DIFFICULTY) {
this->widget_id = widget;
SetDParam(0, _settings_newgame.game_creation.custom_terrain_type);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_TERRAIN_TYPE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.custom_terrain_type), STR_MAPGEN_TERRAIN_TYPE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_NONE);
}
_settings_newgame.difficulty.terrain_type = index;
break;
@@ -925,8 +918,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_WATER_PULLDOWN: {
if ((uint)index == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) {
this->widget_id = widget;
SetDParam(0, _settings_newgame.game_creation.custom_sea_level);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_SEA_LEVEL, 3, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.custom_sea_level), STR_MAPGEN_SEA_LEVEL, 3, this, CS_NUMERAL, QSF_NONE);
}
_settings_newgame.difficulty.quantity_sea_lakes = index;
break;
@@ -1191,8 +1183,7 @@ struct CreateScenarioWindow : public Window
case WID_CS_START_DATE_TEXT: // Year text
this->widget_id = WID_CS_START_DATE_TEXT;
SetDParam(0, _settings_newgame.game_creation.starting_year);
ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.starting_year), STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_NONE);
break;
case WID_CS_FLAT_LAND_HEIGHT_DOWN:
@@ -1209,8 +1200,7 @@ struct CreateScenarioWindow : public Window
case WID_CS_FLAT_LAND_HEIGHT_TEXT: // Height level text
this->widget_id = WID_CS_FLAT_LAND_HEIGHT_TEXT;
SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_NONE);
ShowQueryString(GetString(STR_JUST_INT, _settings_newgame.game_creation.se_flat_world_height), STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_NONE);
break;
}
}