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

Method OnQueryTextFinished

src/town_gui.cpp:1305–1320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 6

ParseIntegerFunction · 0.85
GenerateTownsFunction · 0.85
ShowErrorMessageFunction · 0.85
GetEncodedStringFunction · 0.70
RestoreMethod · 0.45

Tested by

no test coverage detected