Functions

# newgrf_town.cpp File Reference

Implementation of the town part of NewGRF houses. More...

`#include "stdafx.h"`
`#include "debug.h"`
`#include "town.h"`
`#include "newgrf_spritegroup.h"`

Go to the source code of this file.

## Functions
uint32 | TownGetVariable (byte variable, uint32 parameter, bool *available, Town *t, const GRFFile *caller_grffile)
| This function implements the town variables that newGRF defines.
void | TownStorePSA (Town *t, const GRFFile *caller_grffile, uint pos, int32 value)
| Store a value in town persistent storage.

## Detailed Description

Implementation of the town part of NewGRF houses.

Definition in file newgrf_town.cpp.

## Function Documentation

uint32 TownGetVariable | ( | byte | variable,
|  | uint32 | parameter,
|  | bool * | available,
|  | Town * | t,
|  | const GRFFile * | caller_grffile |
| ) |  |  |

This function implements the town variables that newGRF defines.

Parameters:

  | variable | that is queried
  | parameter | unused
  | available | will return false if ever the variable asked for does not exist
  | t | is of course the town we are inquiring
  | caller_grffile | GRFFile of the entity asking for a town variable.

Returns:
  the value stored in the corresponding variable

Definition at line 26 of file newgrf_town.cpp.

References _settings_game, ClampToU16(), DEBUG, GameSettings::economy, Town::fund_buildings_months, GB(), GetRegister(), Town::grow_counter, Town::growth_rate, Town::have_ratings, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Town::larger_town, EconomySettings::larger_towns, TransportedCargoStat< Tstorage >::new_act, TransportedCargoStat< Tstorage >::new_max, Town::num_houses, TransportedCargoStat< Tstorage >::old_act, TransportedCargoStat< Tstorage >::old_max, Town::population, Town::ratings, Town::received, Town::road_build_months, Town::squared_town_zone_radius, Town::statues, Town::supplied, TE_FOOD, TE_WATER, TOWN_GROW_RATE_CUSTOM, and Town::xy.

Referenced by HouseGetVariable(), IndustryGetVariable(), ObjectGetVariable(), and NIHTown::Resolve().

void TownStorePSA | ( | Town * | t,
|  | const GRFFile * | caller_grffile,
|  | uint | pos,
|  | int32 | value |
| ) |  |  |

Store a value in town persistent storage.

Parameters:

  | t | Town owning the persistent storage.
  | caller_grffile | GRFFile of the entity that wants to use the storage.
  | pos | Position to write at.
  | value | Value to write.

Returns:
  the value stored in the corresponding variable

Definition at line 137 of file newgrf_town.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_persistent_storage_pool >::CanAllocateItem(), GetRegister(), and PersistentStorageArray< TYPE, SIZE >::StoreValue().

Referenced by HouseStorePSA(), IndustryStorePSA(), ObjectStorePSA(), and StationStorePSA().