OpenTTD Source 20241224-master-gf74b0cf984
object_map.h File Reference

Map accessors for object tiles. More...

#include "water_map.h"
#include "object_type.h"

Go to the source code of this file.

Functions

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

Detailed Description

Map accessors for object tiles.

Definition in file object_map.h.

Function Documentation

◆ GetObjectIndex()

ObjectID GetObjectIndex ( Tile  t)
inline

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

Parameters
tthe tile
Precondition
IsTileType(t, MP_OBJECT)
Returns
The ObjectID of the object.

Definition at line 47 of file object_map.h.

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

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

◆ GetObjectRandomBits()

uint8_t GetObjectRandomBits ( Tile  t)
inline

Get the random bits of this tile.

Parameters
tThe 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 IsTileType(), Tile::m3(), and MP_OBJECT.

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

◆ GetObjectType()

ObjectType GetObjectType ( Tile  t)

Gets the ObjectType of the given object tile.

Parameters
tthe tile to get the type from.
Precondition
IsTileType(t, MP_OBJECT)
Returns
the type.

Definition at line 66 of file object_cmd.cpp.

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

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

◆ IsObjectType()

bool IsObjectType ( Tile  t,
ObjectType  type 
)
inline

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

Parameters
tTile to test.
typeType to test.
Precondition
IsTileType(t, MP_OBJECT)
Returns
True if type matches.

Definition at line 25 of file object_map.h.

References GetObjectType().

Referenced by CmdBuildObject().

◆ IsObjectTypeTile()

bool IsObjectTypeTile ( Tile  t,
ObjectType  type 
)
inline

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

Parameters
tTile to test.
typeType 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()

void MakeObject ( Tile  t,
Owner  o,
ObjectID  index,
WaterClass  wc,
uint8_t  random 
)
inline

Make an Object tile.

Parameters
tThe tile to make and object tile.
oThe new owner of the tile.
indexIndex to the object.
wcWater class for this object.
randomRandom data to store on the tile

Definition at line 74 of file object_map.h.

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

Referenced by BuildObject().