34 static const uint INVALID_TOWN = 0xFFFF;
50 uint32 squared_town_zone_radius[HZB_END];
85 inline byte GetPercentTransported(
CargoID cid)
const {
return this->supplied[cid].
old_act * 256 / (this->supplied[cid].
old_max + 1); }
103 std::list<PersistentStorage *> psa_list;
130 void UpdateVirtCoord();
137 static Town *GetRandom();
138 static void PostDestructor(
size_t index);
144 void ShowTownViewWindow(TownID town);
145 void ExpandTown(
Town *t);
177 #define FOR_ALL_TOWNS_FROM(var, start) FOR_ALL_ITEMS_FROM(Town, town_index, var, start) 178 #define FOR_ALL_TOWNS(var) FOR_ALL_TOWNS_FROM(var, 0) 183 void UpdateTownMaxPass(
Town *t);
184 void UpdateTownRadius(
Town *t);
221 extern TownID _new_town_id;
232 assert(obj->name == NULL || obj->town_cn == UINT16_MAX);
253 T *lobj = T::GetIfValid(cid);
256 if (lobj != NULL && obj != lobj) {
258 if (lobj->town == obj->town && lobj->IsOfType(obj)) {
260 uint i = (uint)lobj->town_cn - next;
270 }
while (
HasBit(used, 0));
281 if (cid == T::GetPoolSize()) cid = 0;
282 }
while (cid != idx);
284 obj->town_cn = (uint16)next;
static const uint TOWN_GROWTH_WINTER
The town only needs this cargo in the winter (any amount)
TileIndexDiff GetHouseNorthPart(HouseID &house)
Determines if a given HouseID is part of a multitile house.
AcceptanceMatrix cargo_accepted
Bitmap of cargoes accepted by houses for each 4*4 map square of the town.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
There can be only one stadium by town.
TownRatingCheckType
Action types that a company must ask permission for to a town authority.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
void UpdateTownCargoes(Town *t)
Update cargo acceptance for the complete town.
CompanyMask statues
which companies have a statue?
basic types related to subsidies
static const uint CUSTOM_TOWN_MAX_NUMBER
this is the maximum number of towns a user can specify in customisation
void UpdateTownCargoTotal(Town *t)
Update the total cargo acceptance of the whole town.
EconomySettings economy
settings to change the economy
int32 TileIndexDiff
An offset value between to tiles.
static Titem * Get(size_t index)
Returns Titem with given index.
byte fund_buildings_months
fund buildings program in action?
CompanyByte exclusivity
which company has exclusivity
Functionality related to the temporary and persistent storage arrays for NewGRFs. ...
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Specification of a cargo type.
Medium advertising campaign.
Town(TileIndex tile=INVALID_TILE)
Creates a new town.
void UpdateAllTownVirtCoords()
Update the virtual coords needed to draw the town sign for all towns.
DifficultySettings difficulty
settings related to the difficulty
uint16 time_until_rebuild
time until we rebuild a house
void SetTownRatingTestMode(bool mode)
Switch the town rating to test-mode, to allow commands to be tested without affecting current ratings...
Template for storing a value per area of the map.
uint32 cargo_produced
Bitmap of all cargoes produced by houses in this town.
uint32 cargo_accepted_total
NOSAVE: Bitmap of all cargoes accepted by houses in this town.
Common return value for all commands.
bool GenerateTowns(TownLayout layout)
This function will generate a certain amount of towns, with a certain layout It can be called from th...
uint32 GetWorldPopulation()
Determines the world population Basically, count population of all towns, one by one.
static T max(const T a, const T b)
Returns the maximum of two values.
uint16 HouseID
OpenTTD ID of house types.
uint32 population
Current population of people.
uint16 noise_reached
level of noise that all the airports are generating
const byte _town_action_costs[TACT_COUNT]
Factor in the cost of each town action.
void UpdateTownCargoBitmap()
Updates the bitmap of all cargoes accepted by houses.
static const HouseID NUM_HOUSES
Total number of houses.
Types related to viewports.
Large advertising campaign.
TownActions
Town actions of a company.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
TownEffect
Town growth effect when delivering cargo.
TileIndex xy
town center tile
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
ViewportSign sign
Location of name sign, UpdateVirtCoord updates this.
static TownID GetTownIndex(TileIndex t)
Get the index of which town this house/street is attached to.
All possible advertising actions.
DoCommandFlag
List of flags for a command.
All possible construction actions.
static const uint16 TOWN_GROW_RATE_CUSTOM
If this mask is applied to Town::growth_rate, the grow_counter will not be calculated by the system (...
uint16 town_noise_population[3]
population to base decision on noise evaluation (
Location information about a sign as seen on the viewport.
BuildingCounts< uint16 > building_counts
The number of each type of building in the town.
Number of available town actions.
const CargoSpec * FindFirstCargoWithTownEffect(TownEffect effect)
Determines the first cargo with a certain town effect.
All possible funding actions.
uint32 _town_cargoes_accepted
Bitmap of all cargoes accepted by houses.
Small advertising campaign.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Base class for all PoolItems.
Maximum number of companies.
uint16 MaxTownNoise() const
Calculate the max town noise.
Number of town checking action types.
Base class for all pools.
Removal of a tunnel or bridge owned by the towb.
Maximal number of cargo types in a game.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
char * text
General text with additional information.
static const uint CUSTOM_TOWN_NUMBER_DIFFICULTY
value for custom town number in difficulty settings
static const uint TOWN_GROWTH_DESERT
The town needs the cargo for growth when on desert (any amount)
uint16 growth_rate
town growth rate
CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
Checks whether the local authority allows construction of a new station (rail, road, airport, dock) on the given tile.
Tstorage old_max
Maximum amount last month.
There can be only one church by town.
uint32 TileIndex
The index/ID of a Tile.
static const uint HOUSE_CLASS_MAX
There can only be as many classes as there are new houses, plus one for NO_CLASS, as the original hou...
Buy exclusive transport rights.
static const uint16 TOWN_GROW_RATE_CUSTOM_NONE
Special value for Town::growth_rate to disable town growth.
byte town_council_tolerance
minimum required town ratings to be allowed to demolish stuff
Removal of a road owned by the town.
uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
Get a list of available actions to do at a town.
TownFlags
This enum is used in conjunction with town->flags.
TownCache cache
Container for all cacheable data.
uint8 exclusive_counter
months till the exclusivity expires
Types/functions related to cargoes.
bool larger_town
if this is a larger town and should grow more quickly
char * name
Custom town name. If NULL, the town was not renamed and uses the generated name.
Data structure with cached data of towns.
TownLayoutByte layout
town specific road layout
PartOfSubsidyByte part_of_subsidy
Is this town a source/destination of a subsidy?
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Try to bribe the council.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Owner
Enum for all companies/owners.
uint32 num_houses
Amount of houses.
Conditions for town growth are met. Grow according to Town::growth_rate.
byte road_build_months
fund road reconstruction in action?
uint16 grow_counter
counter to count when to grow, value is smaller than or equal to growth_rate
CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType type)
Does the town authority allow the (destructive) action of the current company?
Tstorage old_act
Actually transported last month.
void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
Changes town rating of the current company.
CompanyMask have_ratings
which companies have a rating