#include <town.h>
Public Member Functions | |
| Town (TileIndex tile=INVALID_TILE) | |
| Creates a new town. | |
| ~Town () | |
| Destroy the town. | |
| void | InitializeLayout (TownLayout layout) |
| Assigns town layout. | |
| uint16 | MaxTownNoise () const |
| Calculate the max town noise. | |
| void | UpdateVirtCoord () |
| Resize the sign(label) of the town after changes in population (creation or growth or else). | |
Static Public Member Functions | |
| static FORCEINLINE Town * | GetByTile (TileIndex tile) |
| static Town * | GetRandom () |
| Return a random valid town. | |
| static void | PostDestructor (size_t index) |
| Invalidating of the "nearest town cache" has to be done after removing item from the pool. | |
Data Fields | |
| TileIndex | xy |
| uint32 | num_houses |
| uint32 | population |
| uint32 | townnamegrfid |
| uint16 | townnametype |
| uint32 | townnameparts |
| char * | name |
| ViewportSign | sign |
| byte | flags |
| uint16 | noise_reached |
| CompanyMask | statues |
| CompanyMask | have_ratings |
| uint8 | unwanted [MAX_COMPANIES] |
| how many months companies aren't wanted by towns (bribe) | |
| CompanyByte | exclusivity |
| which company has exclusivity | |
| uint8 | exclusive_counter |
| months till the exclusivity expires | |
| int16 | ratings [MAX_COMPANIES] |
| Ratings of each company for this town. | |
| uint32 | max_pass |
| uint32 | max_mail |
| uint32 | new_max_pass |
| uint32 | new_max_mail |
| uint32 | act_pass |
| uint32 | act_mail |
| uint32 | new_act_pass |
| uint32 | new_act_mail |
| byte | pct_pass_transported |
| byte | pct_mail_transported |
| uint16 | act_food |
| uint16 | act_water |
| uint16 | new_act_food |
| uint16 | new_act_water |
| uint16 | time_until_rebuild |
| uint16 | grow_counter |
| int16 | growth_rate |
| byte | fund_buildings_months |
| byte | road_build_months |
| bool | larger_town |
| TownLayoutByte | layout |
| town specific road layout | |
| PartOfSubsidyByte | part_of_subsidy |
| NOSAVE: is this town a source/destination of a subsidy? | |
| uint32 | squared_town_zone_radius [HZB_END] |
| BuildingCounts< uint16 > | building_counts |
| NOSAVE: The number of each type of building in the town. | |
Town data structure.
Definition at line 36 of file town.h.
| Town * Town::GetRandom | ( | ) | [static] |
Return a random valid town.
Definition at line 139 of file town_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::GetPoolSize(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::IsValidID(), and MAX_UVALUE.
| void Town::InitializeLayout | ( | TownLayout | layout | ) |
Assigns town layout.
If Random, generates one based on TileHash.
Definition at line 125 of file town_cmd.cpp.
References NUM_TLS, TileHash(), TileX(), TileY(), and TL_RANDOM.
Referenced by DoCreateTown().
| uint16 Town::MaxTownNoise | ( | ) | const [inline] |
Calculate the max town noise.
The value is counted using the population divided by the content of the entry in town_noise_population corresponding to the town's tolerance.
Definition at line 131 of file town.h.
References _settings_game, GameSettings::difficulty, GameSettings::economy, DifficultySettings::town_council_tolerance, and EconomySettings::town_noise_population.
Referenced by CmdBuildAirport(), TownViewWindow::DrawWidget(), and AITown::GetAllowedNoise().
| void Town::PostDestructor | ( | size_t | index | ) | [static] |
Invalidating of the "nearest town cache" has to be done after removing item from the pool.
| index | index of deleted item |
Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >.
Definition at line 110 of file town_cmd.cpp.
References CalcClosestTownFromTile(), InvalidateWindowData(), Object::location, TileArea::tile, Object::town, and UpdateNearestTownForRoadTiles().
1.7.1