diff options
author | smatz <smatz@openttd.org> | 2009-02-04 20:17:25 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-02-04 20:17:25 +0000 |
commit | 832e392855c652766de1bdd15851f81d651eb9d6 (patch) | |
tree | 5a4050971fc92ae40d7612fdd0947e42eb1ae263 /src/town.h | |
parent | 030984a763c0111ba17c8907a22cffe0eeb05f68 (diff) | |
download | openttd-832e392855c652766de1bdd15851f81d651eb9d6.tar.xz |
(svn r15340) -Fix [FS#2121]: changing town road layout in-game caused ugly road networks
-Fix: use a flag instead of TL_NO_ROADS to forbid towns to build roads. The flag is ignored during world generation, so there won't be 'ghost' towns anymore
-Feature: town layout is now stored per town, so it is possible to (manually) set different layout for each town
Diffstat (limited to 'src/town.h')
-rw-r--r-- | src/town.h | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/town.h b/src/town.h index 6b80762bf..62a6b2524 100644 --- a/src/town.h +++ b/src/town.h @@ -166,6 +166,7 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> { /* If this is a larger town, and should grow more quickly. */ bool larger_town; + TownLayoutByte layout; ///< town specific road layout /* NOSAVE: UpdateTownRadius updates this given the house count. */ uint32 squared_town_zone_radius[HZB_END]; @@ -173,9 +174,6 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> { /* NOSAVE: The number of each type of building in the town. */ BuildingCounts building_counts; - /* NOSAVE: The town specific road layout */ - TownLayout layout; - /** * Creates a new town */ @@ -188,30 +186,20 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> { void InitializeLayout(); - inline TownLayout GetActiveLayout() const; - /** Calculate the max town noise * The value is counted using the population divided by the content of the * entry in town_noise_population corespondig to the town's tolerance. * To this result, we add 3, which is the noise of the lowest airport. * So user can at least buld that airport * @return the maximum noise level the town will tolerate */ - inline uint16 MaxTownNoise() const { + inline uint16 MaxTownNoise() const + { if (this->population == 0) return 0; // no population? no noise return ((this->population / _settings_game.economy.town_noise_population[_settings_game.difficulty.town_council_tolerance]) + 3); } }; -/** - * Get the current valid layout for the town - * @return the active layout for this town - */ -inline TownLayout Town::GetActiveLayout() const -{ - return (_settings_game.economy.town_layout == TL_RANDOM) ? this->layout : _settings_game.economy.town_layout; -} - struct HouseSpec { /* Standard properties */ Year min_year; ///< introduction year of the house |