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

Function CheckTownRoadTypes

src/town_cmd.cpp:1015–1031  ·  view source on GitHub ↗

* Check if towns are able to build road. * @return true iff the towns are currently able to build road. */

Source from the content-addressed store, hash-verified

1013 * @return true iff the towns are currently able to build road.
1014 */
1015bool CheckTownRoadTypes()
1016{
1017 auto min_date = GetTownRoadTypeFirstIntroductionDate();
1018 if (min_date <= TimerGameCalendar::date) return true;
1019
1020 if (min_date < INT32_MAX) {
1021 ShowErrorMessage(
1022 GetEncodedString(STR_ERROR_NO_TOWN_ROADTYPES_AVAILABLE_YET),
1023 GetEncodedString(STR_ERROR_NO_TOWN_ROADTYPES_AVAILABLE_YET_EXPLANATION, min_date),
1024 WL_CRITICAL);
1025 } else {
1026 ShowErrorMessage(
1027 GetEncodedString(STR_ERROR_NO_TOWN_ROADTYPES_AVAILABLE_AT_ALL),
1028 GetEncodedString(STR_ERROR_NO_TOWN_ROADTYPES_AVAILABLE_AT_ALL_EXPLANATION), WL_CRITICAL);
1029 }
1030 return false;
1031}
1032
1033/**
1034 * Check for parallel road inside a given distance.

Callers 1

_GenerateWorldFunction · 0.85

Calls 3

ShowErrorMessageFunction · 0.85
GetEncodedStringFunction · 0.70

Tested by

no test coverage detected