Increase church/stadium count field size, fix save/load

Fix too many error message
This commit is contained in:
Jonathan G Rennison
2020-08-03 20:21:02 +01:00
parent 4a21fafd5c
commit 1fd9c929ef
4 changed files with 8 additions and 5 deletions

View File

@@ -2621,10 +2621,11 @@ static CommandCost CheckCanBuildHouse(HouseID house, const Town *t, bool manual)
}
/* Special houses that there can be only one of. */
bool multiple_buildings = (manual && _settings_client.scenario.multiple_buildings);
if (hs->building_flags & BUILDING_IS_CHURCH) {
if (t->church_count >= ((manual && _settings_client.scenario.multiple_buildings) ? 255 : 1)) return_cmd_error(STR_ERROR_ONLY_ONE_BUILDING_ALLOWED_PER_TOWN);
if (t->church_count >= (multiple_buildings ? UINT16_MAX : 1)) return_cmd_error(multiple_buildings ? STR_ERROR_NO_MORE_BUILDINGS_ALLOWED_PER_TOWN : STR_ERROR_ONLY_ONE_BUILDING_ALLOWED_PER_TOWN);
} else if (hs->building_flags & BUILDING_IS_STADIUM) {
if (t->stadium_count >= ((manual && _settings_client.scenario.multiple_buildings) ? 255 : 1)) return_cmd_error(STR_ERROR_ONLY_ONE_BUILDING_ALLOWED_PER_TOWN);
if (t->stadium_count >= (multiple_buildings ? UINT16_MAX : 1)) return_cmd_error(multiple_buildings ? STR_ERROR_NO_MORE_BUILDINGS_ALLOWED_PER_TOWN : STR_ERROR_ONLY_ONE_BUILDING_ALLOWED_PER_TOWN);
}
return CommandCost();