| 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 | |
| 1252 | static constexpr std::initializer_list<NWidgetPart> _nested_create_scenario_widgets = { |
nothing calls this directly
no test coverage detected