OpenTTD Source 20261112-master-gbcbec5e63f
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_town.h"
#include "newgrf_cargo.h"
#include "timer/timer_game_tick.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

static uint16_t TownProductionHistoryHelper (const Town *t, CargoLabel label, uint period, auto proj)
 Get cargo production/transport history for a town via cargo label.
static uint32_t TownProductionHistoryHelperCargoID (const Town *t, uint32_t parameter, const GRFFile *grffile, uint period, auto proj)
 Get cargo production/transport history for a town via cargo translation table.
static uint32_t TownAcceptanceHistoryHelperCargoID (const Town *t, uint32_t parameter, const GRFFile *grffile, uint period, auto proj)
 Get cargo acceptance history for a town via cargo translation table.
static uint32_t GetNearbyTileInformation (uint8_t parameter, TileIndex tile, bool grf_version8)
 Get information about a nearby tile.

Detailed Description

Implementation of the town part of NewGRF houses.

Definition in file newgrf_town.cpp.

Function Documentation

◆ GetNearbyTileInformation()

uint32_t GetNearbyTileInformation ( uint8_t parameter,
TileIndex tile,
bool grf_version8 )
static

Get information about a nearby tile.

Parameters
parameterPair of coordinates from callback.
tileTileIndex from which the callback was initiated.
grf_version8True, if we are dealing with a new NewGRF which uses GRF version >= 8.
Returns
a construction of bits obeying the newgrf format.

Definition at line 82 of file newgrf_town.cpp.

References GetNearbyTile(), and GetNearbyTileInformation().

Referenced by GetNearbyTileInformation().

◆ TownAcceptanceHistoryHelperCargoID()

uint32_t TownAcceptanceHistoryHelperCargoID ( const Town * t,
uint32_t parameter,
const GRFFile * grffile,
uint period,
auto proj )
static

Get cargo acceptance history for a town via cargo translation table.

Parameters
tTown to query.
parameterCargo ID from callback.
grffileGRF file to use for cargo translation.
periodPeriod to query.
projProjection to apply on the history data.
Returns
The cargo quantity for the given period and projection, or 0 if invalid.

Definition at line 64 of file newgrf_town.cpp.

References Town::accepted, ClampTo(), Town::GetCargoAccepted(), GetCargoTranslation(), and IsValidCargoType().

Referenced by TownScopeResolver::GetVariable().

◆ TownProductionHistoryHelper()

uint16_t TownProductionHistoryHelper ( const Town * t,
CargoLabel label,
uint period,
auto proj )
static

Get cargo production/transport history for a town via cargo label.

Parameters
tTown to query.
labelCargo label from callback.
periodPeriod to query.
projProjection to apply on the history data.
Returns
The cargo quantity for the given period and projection, or 0 if invalid.

Definition at line 27 of file newgrf_town.cpp.

References ClampTo(), GetCargoTypeByLabel(), and Town::supplied.

Referenced by TownScopeResolver::GetVariable().

◆ TownProductionHistoryHelperCargoID()

uint32_t TownProductionHistoryHelperCargoID ( const Town * t,
uint32_t parameter,
const GRFFile * grffile,
uint period,
auto proj )
static

Get cargo production/transport history for a town via cargo translation table.

Parameters
tTown to query.
parameterCargo ID from callback.
grffileGRF file to use for cargo translation.
periodPeriod to query.
projProjection to apply on the history data.
Returns
The cargo quantity for the given period and projection, or 0 if invalid.

Definition at line 44 of file newgrf_town.cpp.

References ClampTo(), GetCargoTranslation(), IsValidCargoType(), and Town::supplied.

Referenced by TownScopeResolver::GetVariable().