OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Functions | Variables
town_sl.cpp File Reference

Code handling saving and loading of towns and houses. More...

`#include "../stdafx.h"`
`#include "../newgrf_house.h"`
`#include "../town.h"`
`#include "../landscape.h"`
`#include "../subsidy_func.h"`
`#include "saveload.h"`
`#include "newgrf_sl.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Functions
void | RebuildTownCaches ()
| Rebuild all the cached variables of towns.
void | UpdateHousesAndTowns ()
| Check and update town and house values.
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.

## Detailed Description

Code handling saving and loading of towns and houses.

Definition in file town_sl.cpp.

## Function Documentation

static void Ptrs_TOWN | ( |  | ) |
| static

Fix pointers when loading town data.

Definition at line 307 of file town_sl.cpp.

References IsSavegameVersionBefore(), and SlObject().

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 HouseSpec::building_flags, GetCleanHouseType(), GetHouseNorthPart(), OverrideManagerBase::GetSubstituteID(), IsTileType(), MapSize(), MP_HOUSE, NEW_HOUSE_OFFSET, RebuildTownCaches(), SetHouseType(), and TileDiffXY().

Referenced by AfterLoadGame(), and ReloadNewGRFData().

## Variable Documentation

const ChunkHandler _town_chunk_handlers[]

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

Chunk handler for towns.

const SaveLoad _town_desc[]
| static

Save and load of towns.

Definition at line 117 of file town_sl.cpp.

const SaveLoad _town_received_desc[]
| static

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

Definition at line 211 of file town_sl.cpp.

const SaveLoad _town_supplied_desc[]
| static

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

Definition at line 202 of file town_sl.cpp.