newgrf_commons.h File Reference

This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities. More...

#include "tile_type.h"

Go to the source code of this file.

Data Structures

struct  EntityIDMapping
 Maps an entity id stored on the map to a GRF file. More...
class  OverrideManagerBase
class  HouseOverrideManager
class  IndustryOverrideManager
class  IndustryTileOverrideManager
class  AirportOverrideManager
class  AirportTileOverrideManager
class  ObjectOverrideManager
struct  GRFFilePropsBase< Tcnt >
 Data related to the handling of grf files. More...
struct  GRFFileProps
 Data related to the handling of grf files. More...

Enumerations

enum  TileContext { TCX_NORMAL, TCX_UPPER_HALFTILE, TCX_ON_BRIDGE }
 

Contextx for tile accesses.

More...

Functions

uint32 GetTerrainType (TileIndex tile, TileContext context=TCX_NORMAL)
 Function used by houses (and soon industries) to get information on type of "terrain" the tile it is queries sits on.
TileIndex GetNearbyTile (byte parameter, TileIndex tile, bool signed_offsets=true)
uint32 GetNearbyTileInformation (TileIndex tile)
 Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.

Variables

HouseOverrideManager _house_mngr
IndustryOverrideManager _industry_mngr
IndustryTileOverrideManager _industile_mngr
AirportOverrideManager _airport_mngr
AirportTileOverrideManager _airporttile_mngr
ObjectOverrideManager _object_mngr
 The override manager for our objects.

Detailed Description

This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.

Definition in file newgrf_commons.h.


Enumeration Type Documentation

Contextx for tile accesses.

Enumerator:
TCX_NORMAL 

Nothing special.

TCX_UPPER_HALFTILE 

Querying information about the upper part of a tile with halftile foundation.

TCX_ON_BRIDGE 

Querying information about stuff on the bridge (via some bridgehead).

Definition at line 21 of file newgrf_commons.h.


Function Documentation

uint32 GetNearbyTileInformation ( TileIndex  tile  ) 

Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.

Parameters:
tile the tile of interest.
Returns:
0czzbbss: c = TileType; zz = TileZ; bb: 7-3 zero, 4-2 TerrainType, 1 water/shore, 0 zero; ss = TileSlope

Definition at line 419 of file newgrf_commons.cpp.

References GetTerrainType(), GetTileSlope(), GetTileType(), GetTreeGround(), IsTileType(), MP_TREES, MP_WATER, and TREE_GROUND_SHORE.

Referenced by GetNearbyAirportTileInformation(), GetNearbyIndustryTileInformation(), GetNearbyObjectTileInformation(), and HouseGetVariable().

uint32 GetTerrainType ( TileIndex  tile,
TileContext  context 
)

Function used by houses (and soon industries) to get information on type of "terrain" the tile it is queries sits on.

Parameters:
tile TileIndex of the tile been queried
upper_halftile If true, query upper halftile in case of rail tiles.
Returns:
value corresponding to the grf expected format: Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline

Definition at line 331 of file newgrf_commons.cpp.

References _generating_world, _settings_game, GameSettings::game_creation, GetBridgeHeight(), GetClearDensity(), GetSnowLine(), GetTileMaxZ(), GetTileType(), GetTileZ(), GetTreeDensity(), GetTreeGround(), GetTropicZone(), HasTunnelBridgeSnowOrDesert(), IsOnSnow(), IsSnowTile(), GameCreationSettings::landscape, MP_CLEAR, MP_HOUSE, MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_VOID, MP_WATER, RAIL_GROUND_HALF_SNOW, RAIL_GROUND_ICE_DESERT, TCX_ON_BRIDGE, TCX_UPPER_HALFTILE, TREE_GROUND_ROUGH_SNOW, and TREE_GROUND_SNOW_DESERT.

Referenced by GetNearbyTileInformation(), HouseGetVariable(), and ObjectGetVariable().


Variable Documentation

The override manager for our objects.

Referenced by FinaliseObjectsArray(), and GetCountAndDistanceOfClosestInstance().


Generated on Thu Jan 20 22:57:48 2011 for OpenTTD by  doxygen 1.6.1