| 1303 | } |
| 1304 | |
| 1305 | void OnQueryTextFinished(std::optional<std::string> str) override |
| 1306 | { |
| 1307 | /* Was 'cancel' pressed? */ |
| 1308 | if (!str.has_value()) return; |
| 1309 | |
| 1310 | auto value = ParseInteger(*str, 10, true); |
| 1311 | if (!value.has_value()) return; |
| 1312 | |
| 1313 | Backup<bool> old_generating_world(_generating_world, true); |
| 1314 | UpdateNearestTownForRoadTiles(true); |
| 1315 | if (!GenerateTowns(this->town_layout, value)) { |
| 1316 | ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_GENERATE_TOWN), GetEncodedString(STR_ERROR_NO_SPACE_FOR_TOWN), WL_INFO); |
| 1317 | } |
| 1318 | UpdateNearestTownForRoadTiles(false); |
| 1319 | old_generating_world.Restore(); |
| 1320 | } |
| 1321 | |
| 1322 | void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override |
| 1323 | { |
nothing calls this directly
no test coverage detected