MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnQueryTextFinished

Method OnQueryTextFinished

src/genworld_gui.cpp:1229–1249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227 }
1228
1229 void OnQueryTextFinished(std::optional<std::string> str) override
1230 {
1231 if (!str.has_value()) return;
1232
1233 auto value = ParseInteger<int32_t>(*str, 10, true);
1234 if (!value.has_value()) return;
1235
1236 switch (this->widget_id) {
1237 case WID_CS_START_DATE_TEXT:
1238 this->SetWidgetDirty(WID_CS_START_DATE_TEXT);
1239 _settings_newgame.game_creation.starting_year = Clamp(TimerGameCalendar::Year(*value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
1240 break;
1241
1242 case WID_CS_FLAT_LAND_HEIGHT_TEXT:
1243 this->SetWidgetDirty(WID_CS_FLAT_LAND_HEIGHT_TEXT);
1244 _settings_newgame.game_creation.se_flat_world_height = Clamp(*value, 0, GetMapHeightLimit());
1245 break;
1246 }
1247
1248 this->SetDirty();
1249 }
1250};
1251
1252static constexpr std::initializer_list<NWidgetPart> _nested_create_scenario_widgets = {

Callers

nothing calls this directly

Calls 4

ClampFunction · 0.85
GetMapHeightLimitFunction · 0.85
SetWidgetDirtyMethod · 0.80
SetDirtyMethod · 0.45

Tested by

no test coverage detected