OpenTTD Source: TownCache Struct Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
TownCache Struct Reference

Data structure with cached data of towns. More...

`#include <town.h>`

## Public Member Functions
auto | operator<=> (const TownCache &) const =default

## Data Fields
uint32_t | num_houses = 0
| Amount of houses.
uint32_t | population = 0
| Current population of people.
TrackedViewportSign | sign {}
| Location of name sign, UpdateVirtCoord updates this.
PartsOfSubsidy | part_of_subsidy {}
| Is this town a source/destination of a subsidy?
std::array< uint32_t, NUM_HOUSE_ZONES > | squared_town_zone_radius {}
| UpdateTownRadius updates this given the house count.
BuildingCounts< uint16_t > | building_counts {}
| The number of each type of building in the town.

## Detailed Description

Data structure with cached data of towns.

Definition at line 51 of file town.h.

## Field Documentation

## ◆ building_counts

BuildingCounts<uint16_t> TownCache::building_counts {}

The number of each type of building in the town.

Definition at line 57 of file town.h.

Referenced by DecreaseBuildingCount(), IncreaseBuildingCount(), InitializeBuildingCounts(), and TryBuildTownHouse().

## ◆ num_houses

uint32_t TownCache::num_houses = 0

Amount of houses.

Definition at line 52 of file town.h.

Referenced by BuildTownHouse(), ClearTownHouse(), CmdExpandTown(), DoCreateTown(), GetNormalGrowthRate(), TownScopeResolver::GetVariable(), GrowTownAtRoad(), LoadTownData(), RebuildTownCaches(), and UpdateTownRadius().

## ◆ part_of_subsidy

PartsOfSubsidy TownCache::part_of_subsidy {}

Is this town a source/destination of a subsidy?

Definition at line 55 of file town.h.

Referenced by CheckSubsidised().

## ◆ population

uint32_t TownCache::population = 0

Current population of people.

Definition at line 53 of file town.h.

Referenced by ChangePopulation(), CheckIfIndustryIsAllowed(), CreateRandomTown(), DoCreateTown(), TownViewWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), FindSubsidyPassengerRoute(), FindSubsidyTownCargoRoute(), TownViewWindow::GetDesiredInfoHeight(), TownScopeResolver::GetVariable(), GrowTownWithBridge(), GrowTownWithTunnel(), LoadTownData(), Town::MaxTownNoise(), RebuildTownCaches(), TownDirectoryWindow::TownPopulationSorter(), UpdateTownGrowth(), UpdateTownMaxPass(), and Town::UpdateVirtCoord().

## ◆ sign

TrackedViewportSign TownCache::sign {}

Location of name sign, UpdateVirtCoord updates this.

Definition at line 54 of file town.h.

Referenced by CmdDeleteTown(), and Town::UpdateVirtCoord().

## ◆ squared_town_zone_radius

std::array<uint32_t, NUM_HOUSE_ZONES> TownCache::squared_town_zone_radius {}

UpdateTownRadius updates this given the house count.

Definition at line 56 of file town.h.

Referenced by CmdBuildBridge(), CmdBuildRoad(), CmdBuildTunnel(), TownScopeResolver::GetVariable(), and UpdateTownRadius().

The documentation for this struct was generated from the following file:

- src/town.h