#include <town.h>
Public Member Functions | |
byte | GetPercentTransported (CargoID cid) const |
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 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 |
town center tile | |
uint32 | num_houses |
amount of houses | |
uint32 | population |
current population of people | |
uint32 | townnamegrfid |
uint16 | townnametype |
uint32 | townnameparts |
char * | name |
ViewportSign | sign |
NOSAVE: Location of name sign, UpdateVirtCoord updates this. | |
byte | flags |
uint16 | noise_reached |
level of noise that all the airports are generating | |
CompanyMask | statues |
which companies have a statue? | |
CompanyMask | have_ratings |
which companies have a rating | |
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 | |
TransportedCargoStat< uint32 > | supplied [NUM_CARGO] |
Cargo statistics about supplied cargo. | |
TransportedCargoStat< uint16 > | received [NUM_TE] |
Cargo statistics about received cargotypes. | |
uint32 | goal [NUM_TE] |
Amount of cargo required for the town to grow. | |
char * | text |
General text with additional information. | |
uint32 | cargo_produced |
Bitmap of all cargoes produced by houses in this town. | |
AcceptanceMatrix | cargo_accepted |
Bitmap of cargoes accepted by houses for each 4*4 map square of the town. | |
uint32 | cargo_accepted_total |
NOSAVE: Bitmap of all cargoes accepted by houses in this town. | |
uint16 | time_until_rebuild |
time until we rebuild a house | |
uint16 | grow_counter |
counter to count when to grow | |
uint16 | growth_rate |
town growth rate | |
byte | fund_buildings_months |
fund buildings program in action? | |
byte | road_build_months |
fund road reconstruction in action? | |
bool | larger_town |
if this is a larger town and should grow more quickly | |
TownLayoutByte | layout |
town specific road layout | |
std::list< PersistentStorage * > | psa_list |
PartOfSubsidyByte | part_of_subsidy |
NOSAVE: is this town a source/destination of a subsidy? | |
uint32 | squared_town_zone_radius [HZB_END] |
NOSAVE: UpdateTownRadius updates this given the house count. | |
BuildingCounts< uint16 > | building_counts |
NOSAVE: the number of each type of building in the town. |
Town data structure.
Definition at line 46 of file town.h.
Town::Town | ( | TileIndex | tile = INVALID_TILE |
) | [inline] |
Town::~Town | ( | ) |
Destroy the town.
Definition at line 62 of file town_cmd.cpp.
References ClosestTownFromTile(), DeleteNewGRFInspectWindow(), DeleteSubsidyWith(), DeleteWindowById(), free(), GetTileType(), GetTownIndex(), GSF_FAKE_TOWNS, HasTownOwnedRoad(), CargoPacket::InvalidateAllFrom(), IsTileOwner(), MapSize(), MarkWholeScreenDirty(), MP_HOUSE, MP_ROAD, MP_TUNNELBRIDGE, OWNER_TOWN, ST_TOWN, Object::town, Industry::town, and WC_TOWN_VIEW.
Town * Town::GetRandom | ( | ) | [static] |
Return a random valid town.
Definition at line 145 of file town_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetPoolSize(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::IsValidID(), and MAX_UVALUE.
Referenced by FindSubsidyCargoDestination(), FindSubsidyPassengerRoute(), and FindSubsidyTownCargoRoute().
void Town::InitializeLayout | ( | TownLayout | layout | ) |
Assigns town layout.
If Random, generates one based on TileHash.
Definition at line 131 of file town_cmd.cpp.
References NUM_TLS, TileHash(), TileX(), TileY(), TL_RANDOM, and xy.
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 126 of file town.h.
References _settings_game, GameSettings::difficulty, GameSettings::economy, population, DifficultySettings::town_council_tolerance, and EconomySettings::town_noise_population.
Referenced by CmdBuildAirport(), and TownViewWindow::DrawWidget().
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, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >.
Definition at line 116 of file town_cmd.cpp.
References CalcClosestTownFromTile(), InvalidateWindowData(), Object::location, TileArea::tile, Object::town, UpdateNearestTownForRoadTiles(), and WC_TOWN_DIRECTORY.