OpenTTD Source: src/saveload/town_sl.cpp File Reference

OpenTTD Source 1.11.0-RC1

Typedefs | Functions | Variables
town_sl.cpp File Reference
`#include "../stdafx.h"`
`#include "../newgrf_house.h"`
`#include "../town.h"`
`#include "../landscape.h"`
`#include "../subsidy_func.h"`
`#include "../strings_func.h"`
`#include "../tilematrix_type.hpp"`
`#include "saveload.h"`
`#include "newgrf_sl.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Typedefs
typedef TileMatrix< CargoTypes, 4 > | AcceptanceMatrix

## Functions
void | RebuildTownCaches ()
| Rebuild all the cached variables of towns.
void | UpdateHousesAndTowns ()
| Check and update town and house values. More...
static void | Save_HIDS ()
static void | Load_HIDS ()
const SaveLoad * | GetTileMatrixDesc ()
static void | RealSave_Town (Town *t)
static void | Save_TOWN ()
static void | Load_TOWN ()
static void | Ptrs_TOWN ()
| Fix pointers when loading town data.

## Variables
static const SaveLoad | _town_desc []
| Save and load of towns.
static const SaveLoad | _town_supplied_desc []
static const SaveLoad | _town_received_desc []
const ChunkHandler | _town_chunk_handlers []
| Chunk handler for towns. More...

## Detailed Description

Code handling saving and loading of towns and houses

Definition in file town_sl.cpp.

## Function Documentation

## ◆ UpdateHousesAndTowns()

void UpdateHousesAndTowns | ( |  | ) |

Check and update town and house values.

Checked are the HouseIDs. Updated are the town population the number of houses per town, the town radius and the max passengers of the town.

Definition at line 65 of file town_sl.cpp.

References GetCleanHouseType(), IsTileType(), MapSize(), MP_HOUSE, and NEW_HOUSE_OFFSET.

## Variable Documentation

## ◆ _town_chunk_handlers

const ChunkHandler _town_chunk_handlers[]

Initial value:
= {
{ 'HIDS', Save_HIDS, Load_HIDS, nullptr, nullptr, CH_ARRAY },
{ 'CITY', Save_TOWN, Load_TOWN, Ptrs_TOWN, nullptr, CH_ARRAY | CH_LAST},
}

Chunk handler for towns.

## ◆ _town_received_desc

const SaveLoad _town_received_desc[]
| static

Initial value:
= {
SLE_CONDVAR(TransportedCargoStat<uint16>, old_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint16>, new_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint16>, old_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint16>, new_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
}

Definition at line 210 of file town_sl.cpp.

## ◆ _town_supplied_desc

const SaveLoad _town_supplied_desc[]
| static

Initial value:
= {
SLE_CONDVAR(TransportedCargoStat<uint32>, old_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint32>, new_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint32>, old_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
SLE_CONDVAR(TransportedCargoStat<uint32>, new_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
}

Definition at line 201 of file town_sl.cpp.

SLE_CONDVAR
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition: saveload.h:551
CH_LAST
@ CH_LAST
Last chunk in this array.
Definition: saveload.h:410
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition: saveload.h:328
SLV_165
@ SLV_165
165 23304
Definition: saveload.h:241
Ptrs_TOWN
static void Ptrs_TOWN()
Fix pointers when loading town data.
Definition: town_sl.cpp:295
TransportedCargoStat< uint16 >