Add per-town override to disable town growth

This commit is contained in:
Jonathan G Rennison
2023-01-01 22:13:03 +00:00
parent 42891a6d9d
commit b8c7a0dd20
5 changed files with 42 additions and 6 deletions

View File

@@ -65,6 +65,7 @@ enum TownSettingOverrideFlags {
TSOF_OVERRIDE_BUILD_LEVEL_CROSSINGS = 1,
TSOF_OVERRIDE_BUILD_TUNNELS = 2,
TSOF_OVERRIDE_BUILD_INCLINED_ROADS = 3,
TSOF_OVERRIDE_GROWTH = 4,
};
/** Town data structure. */
@@ -187,6 +188,11 @@ struct Town : TownPool::PoolItem<&_town_pool> {
return this->cached_name.c_str();
}
inline bool IsTownGrowthDisabledByOverride() const
{
return HasBit(this->override_flags, TSOF_OVERRIDE_GROWTH);
}
inline bool GetAllowBuildRoads() const
{
return HasBit(this->override_flags, TSOF_OVERRIDE_BUILD_ROADS) ? HasBit(this->override_values, TSOF_OVERRIDE_BUILD_ROADS) : _settings_game.economy.allow_town_roads;