#include "oldpool.h"
#include "core/random_func.hpp"
#include "cargo_type.h"
#include "tile_type.h"
#include "date_type.h"
#include "town_type.h"
#include "player_type.h"
#include "newgrf_string_type.h"
Go to the source code of this file.
Data Structures | |
struct | BuildingCounts |
struct | Town |
struct | HouseSpec |
Defines | |
#define | FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1U < GetTownPoolSize()) ? GetTown(t->index + 1U) : NULL) if (t->IsValid()) |
#define | FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0) |
Enumerations | |
enum | { HOUSE_NO_CLASS = 0, NEW_HOUSE_OFFSET = 110, HOUSE_MAX = 512, INVALID_TOWN = 0xFFFF, INVALID_HOUSE_ID = 0xFFFF, HOUSE_CLASS_MAX = HOUSE_MAX - NEW_HOUSE_OFFSET + 1 } |
enum | BuildingFlags { TILE_NO_FLAG = 0, TILE_SIZE_1x1 = 1U << 0, TILE_NOT_SLOPED = 1U << 1, TILE_SIZE_2x1 = 1U << 2, TILE_SIZE_1x2 = 1U << 3, TILE_SIZE_2x2 = 1U << 4, BUILDING_IS_ANIMATED = 1U << 5, BUILDING_IS_CHURCH = 1U << 6, BUILDING_IS_STADIUM = 1U << 7, BUILDING_HAS_1_TILE = TILE_SIZE_1x1 | TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_2_TILES_X = TILE_SIZE_2x1 | TILE_SIZE_2x2, BUILDING_2_TILES_Y = TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_HAS_4_TILES = TILE_SIZE_2x2 } |
enum | HouseZonesBits { HZB_TOWN_EDGE = 0, HZB_TOWN_OUTSKIRT, HZB_TOWN_OUTER_SUBURB, HZB_TOWN_INNER_SUBURB, HZB_TOWN_CENTRE } |
enum | HouseZones { HZ_NOZNS = 0x0000, HZ_ZON1 = 1U << HZB_TOWN_EDGE, HZ_ZON2 = 1U << HZB_TOWN_OUTSKIRT, HZ_ZON3 = 1U << HZB_TOWN_OUTER_SUBURB, HZ_ZON4 = 1U << HZB_TOWN_INNER_SUBURB, HZ_ZON5 = 1U << HZB_TOWN_CENTRE, HZ_ZONALL = 0x001F, HZ_SUBARTC_ABOVE = 0x0800, HZ_TEMP = 0x1000, HZ_SUBARTC_BELOW = 0x2000, HZ_SUBTROPIC = 0x4000, HZ_TOYLND = 0x8000 } |
enum | HouseExtraFlags { NO_EXTRA_FLAG = 0, BUILDING_IS_HISTORICAL = 1U << 0, BUILDING_IS_PROTECTED = 1U << 1, SYNCHRONISED_CALLBACK_1B = 1U << 2, CALLBACK_1A_RANDOM_BITS = 1U << 3 } |
enum | { ROAD_REMOVE = 0, UNMOVEABLE_REMOVE = 1, TUNNELBRIDGE_REMOVE = 1, INDUSTRY_REMOVE = 2 } |
enum | { TOWN_IS_FUNDED = 0, TOWN_HAS_CHURCH = 1, TOWN_HAS_STADIUM = 2 } |
This enum is used in conjonction with town->flags12. More... | |
Functions | |
uint32 | GetWorldPopulation () |
Determines the world population Basically, count population of all towns, one by one. | |
void | UpdateTownVirtCoord (Town *t) |
Resize the sign(label) of the town after changes in population (creation or growth or else). | |
void | UpdateAllTownVirtCoords () |
Update the virtual coords needed to draw the town sign for all towns. | |
void | InitializeTown () |
void | ShowTownViewWindow (TownID town) |
void | ExpandTown (Town *t) |
Called from GUI. | |
Town * | CreateRandomTown (uint attempts, TownSizeMode mode, uint size) |
bool | CheckforTownRating (uint32 flags, Town *t, byte type) |
static HouseSpec * | GetHouseSpecs (HouseID house_id) |
static bool | IsValidTownID (TownID index) |
Check if a TownID is valid. | |
static TownID | GetMaxTownIndex () |
static uint | GetNumTowns () |
static Town * | GetRandomTown () |
Return a random valid town. | |
Town * | CalcClosestTownFromTile (TileIndex tile, uint threshold) |
uint | OriginalTileRandomiser (uint x, uint y) |
void | ResetHouses () |
void | ClearTownHouse (Town *t, TileIndex tile) |
void | AfterLoadTown () |
void | UpdateTownMaxPass (Town *t) |
void | UpdateTownRadius (Town *t) |
bool | CheckIfAuthorityAllows (TileIndex tile) |
Town * | ClosestTownFromTile (TileIndex tile, uint threshold) |
void | ChangeTownRating (Town *t, int add, int max) |
HouseZonesBits | GetTownRadiusGroup (const Town *t, TileIndex tile) |
Returns the bit corresponding to the town zone of the specified tile. | |
void | SetTownRatingTestMode (bool mode) |
Variables | |
HouseSpec | _house_specs [HOUSE_MAX] |
static const byte | TOWN_GROWTH_FREQUENCY = 70 |
This is the number of ticks between towns being processed for building new houses or roads. | |
static const byte | TOWN_HOUSE_COMPLETED = 3 |
Simple value that indicates the house has reached the final stage of construction. | |
bool | _town_sort_dirty |
byte | _town_sort_order |
const Town ** | _town_sort |
Town * | _cleared_town |
int | _cleared_town_rating |
Definition in file town.h.
anonymous enum |
This enum is used in conjonction with town->flags12.
IT simply states what bit is used for. It is pretty unrealistic (IMHO) to only have one church/stadium per town, NO MATTER the population of it. And there are 5 more bits available on flags12...
enum HouseExtraFlags |
enum HouseZones |
HouseZonesBits GetTownRadiusGroup | ( | const Town * | t, | |
TileIndex | tile | |||
) |
Returns the bit corresponding to the town zone of the specified tile.
t | Town on which radius is to be found | |
tile | TileIndex where radius needs to be found |
Definition at line 1591 of file town_cmd.cpp.
References DistanceSquare().
Referenced by BuildTownHouse(), HouseGetVariable(), and IndustryGetVariable().
uint32 GetWorldPopulation | ( | ) |
Determines the world population Basically, count population of all towns, one by one.
Definition at line 349 of file town_cmd.cpp.
static bool IsValidTownID | ( | TownID | index | ) | [inline, static] |
Check if a TownID is valid.
index | to inquiry in the pool of town |
Definition at line 261 of file town.h.
Referenced by CmdBuildRoad(), CmdDoTownAction(), CmdRenameTown(), and GetRandomTown().
void UpdateAllTownVirtCoords | ( | ) |
Update the virtual coords needed to draw the town sign for all towns.
Definition at line 322 of file town_cmd.cpp.
References UpdateTownVirtCoord().
Referenced by InitializeWindowsAndCaches().
void UpdateTownVirtCoord | ( | Town * | t | ) |
Resize the sign(label) of the town after changes in population (creation or growth or else).
t | Town to update |
Definition at line 308 of file town_cmd.cpp.
References MarkTownSignDirty(), TILE_SIZE, TileX(), and TileY().
Referenced by ChangePopulation(), CmdRenameTown(), DoCreateTown(), and UpdateAllTownVirtCoords().
const byte TOWN_GROWTH_FREQUENCY = 70 [static] |
const byte TOWN_HOUSE_COMPLETED = 3 [static] |
Simple value that indicates the house has reached the final stage of construction.
Definition at line 234 of file town.h.
Referenced by BuildTownHouse(), GetHouseBuildingStage(), IncHouseConstructionTick(), and MakeHouseTile().