12 #include "../stdafx.h" 13 #include "../newgrf_house.h" 15 #include "../landscape.h" 16 #include "../subsidy_func.h" 17 #include "../strings_func.h" 22 #include "../safeguards.h" 30 InitializeBuildingCounts();
42 town = Town::GetByTile(t);
52 UpdateTownRadius(town);
86 if (t == north_tile) {
87 const HouseSpec *hs = HouseSpec::Get(house_type);
88 bool valid_house =
true;
106 if (!valid_house) DoClearSquare(t);
204 static const SaveLoad _town_supplied_desc[] = {
213 static const SaveLoad _town_received_desc[] = {
222 static void Save_HIDS()
227 static void Load_HIDS()
235 static const SaveLoad _tilematrix_desc[] = {
242 return _tilematrix_desc;
245 static void RealSave_Town(
Town *t)
252 for (
int i = TE_BEGIN; i <
NUM_TE; i++) {
265 static void Save_TOWN()
270 SlSetArrayIndex(t->
index);
275 static void Load_TOWN()
284 for (
CargoID i = 0; i < num_cargo; i++) {
287 for (
int i = TE_BEGIN; i <
TE_END; i++) {
291 if (t->townnamegrfid == 0 && !
IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1) &&
GetStringTab(t->townnametype) != TEXT_TAB_OLD_CUSTOM) {
323 {
'HIDS', Save_HIDS, Load_HIDS, NULL, NULL, CH_ARRAY },
#define SLE_CONDNULL(length, from, to)
Empty space in some savegame versions.
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.
static void Ptrs_TOWN()
Fix pointers when loading town data.
TransportedCargoStat< uint16 > received[NUM_TE]
Cargo statistics about received cargotypes.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
void UpdateTownCargoes(Town *t)
Update cargo acceptance for the complete town.
Code handling saving and loading of NewGRF mappings.
void UpdateTownCargoTotal(Town *t)
Update the total cargo acceptance of the whole town.
2.0 0.3.0 2.1 0.3.1, 0.3.2
#define SLE_CONDSTR(base, variable, type, length, from, to)
Storage of a string in some savegame versions.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
Maximal number of cargo types in a game.
void RebuildTownCaches()
Rebuild all the cached variables of towns.
static const SaveLoad _town_desc[]
Save and load of towns.
void UpdateHousesAndTowns()
Check and update town and house values.
Tindex index
Index of this pool item.
const ChunkHandler _town_chunk_handlers[]
Chunk handler for towns.
Cargo behaves water-like.
static StringTab GetStringTab(StringID str)
Extract the StringTab from a StringID.
uint16 HouseID
OpenTTD ID of house types.
uint32 population
Current population of people.
uint16 w
The width of the area.
#define SLE_CONDLST(base, variable, type, from, to)
Storage of a list in some savegame versions.
void UpdateTownCargoBitmap()
Updates the bitmap of all cargoes accepted by houses.
static void SetHouseType(TileIndex t, HouseID house_id)
Set the house type.
byte population
population (Zero on other tiles in multi tile house.)
void SlArray(void *array, size_t length, VarType conv)
Save/Load an array.
static bool IsHouseCompleted(TileIndex t)
Get the completion of this house.
T * data
Pointer to data array.
Functions/types related to saving and loading games.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
static HouseID GetCleanHouseType(TileIndex t)
Get the type of this house, which is an index into the house spec array without doing any NewGRF rela...
Highest possible saveload version.
allow control codes in the strings
BuildingFlags building_flags
some flags that describe the house (size, stadium etc...)
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Maximum number of companies.
Handlers and description of chunk.
TileArea area
Area covered by the matrix.
void Load_NewGRFMapping(OverrideManagerBase &mapping)
Load a GRF ID + local id -> OpenTTD's id mapping.
#define SLE_END()
End marker of a struct/class save or load.
static uint MapSize()
Get the size of the map.
#define SLE_CONDARR(base, variable, type, length, from, to)
Storage of an array in some savegame versions.
uint32 TileIndex
The index/ID of a Tile.
static HouseID GetHouseType(TileIndex t)
Get the type of this house, which is an index into the house spec array.
void SlObject(void *object, const SaveLoad *sld)
Main SaveLoad function.
TownCache cache
Container for all cacheable data.
static const HouseID NEW_HOUSE_OFFSET
Offset for new houses.
void SlAutolength(AutolengthProc *proc, void *arg)
Do something of which I have no idea what it is :P.
Cargo behaves food/fizzy-drinks-like.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
TransportedCargoStat< uint32 > supplied[NUM_CARGO]
Cargo statistics about supplied cargo.
byte CargoID
Cargo slots to indicate a cargo type within a game.
void IncreaseBuildingCount(Town *t, HouseID house_id)
IncreaseBuildingCount() Increase the count of a building when it has been added by a town...
uint32 num_houses
Amount of houses.
199 PR#6802 Extend cargotypes to 64
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
Save a GRF ID + local id -> OpenTTD's id mapping.
uint16 h
The height of the area.
Last chunk in this array.
4.0 1 4.1 122 0.3.3, 0.3.4 4.2 1222 0.3.5 4.3 1417 4.4 1426
uint16 GetSubstituteID(uint16 entity_id) const
Gives the substitute of the entity, as specified by the grf file.
Load/save a reference to a persistent storage.