OpenTTD Source: src/object_map.h File Reference

OpenTTD Source 12.0-beta1

Functions
object_map.h File Reference
`#include "water_map.h"`
`#include "object_type.h"`

Go to the source code of this file.

## Functions
ObjectType | GetObjectType (TileIndex t)
| Gets the ObjectType of the given object tile. More...
static bool | IsObjectType (TileIndex t, ObjectType type)
| Check whether the object on a tile is of a specific type. More...
static bool | IsObjectTypeTile (TileIndex t, ObjectType type)
| Check whether a tile is a object tile of a specific type. More...
static ObjectID | GetObjectIndex (TileIndex t)
| Get the index of which object this tile is attached to. More...
static byte | GetObjectRandomBits (TileIndex t)
| Get the random bits of this tile. More...
static void | MakeObject (TileIndex t, Owner o, ObjectID index, WaterClass wc, byte random)
| Make an Object tile. More...

## Detailed Description

Map accessors for object tiles.

Definition in file object_map.h.

## Function Documentation

## ◆ GetObjectIndex()

static ObjectID GetObjectIndex | ( | TileIndex | t | ) |
| inlinestatic

Get the index of which object this tile is attached to.

Parameters

  t | the tile

Precondition
  IsTileType(t, MP_OBJECT)

Returns
  The ObjectID of the object.

Definition at line 47 of file object_map.h.

References _m, IsTileType(), Tile::m2, Tile::m5, and MP_OBJECT.

Referenced by Object::GetByTile(), and GetNearbyObjectTileInformation().

## ◆ GetObjectRandomBits()

static byte GetObjectRandomBits | ( | TileIndex | t | ) |
| inlinestatic

Get the random bits of this tile.

Parameters

  t | The tile to get the bits for.

Precondition
  IsTileType(t, MP_OBJECT)

Returns
  The random bits.

Definition at line 59 of file object_map.h.

References _m, IsTileType(), Tile::m3, and MP_OBJECT.

Referenced by ObjectScopeResolver::GetRandomBits(), and ObjectScopeResolver::GetVariable().

## ◆ GetObjectType()

ObjectType GetObjectType | ( | TileIndex | t | ) |

Gets the ObjectType of the given object tile.

Parameters

  t | the tile to get the type from.

Precondition
  IsTileType(t, MP_OBJECT)

Returns
  the type.

Definition at line 61 of file object_cmd.cpp.

References Object::GetByTile(), IsTileType(), MP_OBJECT, and Object::type.

Referenced by ObjectSpec::GetByTile(), IsObjectType(), and IsObjectTypeTile().

## ◆ IsObjectType()

static bool IsObjectType | ( | TileIndex | t,
|  | ObjectType | type
| ) |  |
| inlinestatic

Check whether the object on a tile is of a specific type.

Parameters

  t | Tile to test.
  type | Type to test.

Precondition
  IsTileType(t, MP_OBJECT)

Returns
  True if type matches.

Definition at line 25 of file object_map.h.

References GetObjectType().

## ◆ IsObjectTypeTile()

static bool IsObjectTypeTile | ( | TileIndex | t,
|  | ObjectType | type
| ) |  |
| inlinestatic

Check whether a tile is a object tile of a specific type.

Parameters

  t | Tile to test.
  type | Type to test.

Returns
  True if type matches.

Definition at line 36 of file object_map.h.

References GetObjectType(), IsTileType(), and MP_OBJECT.

Referenced by HasTransmitter().

## ◆ MakeObject()

static void MakeObject | ( | TileIndex | t,
|  | Owner | o,
|  | ObjectID | index,
|  | WaterClass | wc,
|  | byte | random
| ) |  |
| inlinestatic

Make an Object tile.

Parameters

  t | The tile to make and object tile.
  o | The new owner of the tile.
  index | Index to the object.
  wc | Water class for this object.
  random | Random data to store on the tile

Definition at line 74 of file object_map.h.

References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_OBJECT, SB(), SetTileOwner(), SetTileType(), and SetWaterClass().