(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
This commit is contained in:
18
src/town.h
18
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
|
||||
|
Reference in New Issue
Block a user