Public Member Functions | Static Public Member Functions | Data Fields | Static Protected Attributes

# Object Struct Reference

An object, such as transmitter, on the map. More...

`#include <object_base.h>`

Inheritance diagram for Object:

## Public Member Functions
| Object ()
| Make sure the object isn't zeroed.
| ~Object ()
| Make sure the right destructor is called as well!
## Static Public Member Functions
static Object * | GetByTile (TileIndex tile)
| Get the object associated with a tile.
static void | IncTypeCount (ObjectType type)
| Increment the count of objects for this type.
static void | DecTypeCount (ObjectType type)
| Decrement the count of objects for this type.
static uint16 | GetTypeCount (ObjectType type)
| Get the count of objects for this type.
static void | ResetTypeCounts ()
| Resets object counts.
## Data Fields
Town * | town
| Town the object is built in.
TileArea | location
| Location of the object.
Date | build_date
| Date of construction.
byte | colour
| Colour of the object, for display purpose.
byte | view
| The view setting for this object.
## Static Protected Attributes
static uint16 | counts [NUM_OBJECTS]
| Number of objects per type ingame.

## Detailed Description

An object, such as transmitter, on the map.

Definition at line 25 of file object_base.h.

## Constructor & Destructor Documentation

Object::Object | ( |  | ) | `[inline]`

Make sure the object isn't zeroed.

Definition at line 33 of file object_base.h.

## Member Function Documentation

static void Object::DecTypeCount | ( | ObjectType | type | ) | `[inline, static]`

Decrement the count of objects for this type.

Parameters:

  | type | ObjectType to decrement

Precondition:
  type < NUM_OBJECTS

Definition at line 55 of file object_base.h.

References counts, and NUM_OBJECTS.

Referenced by ReallyClearObjectTile().

Object * Object::GetByTile | ( | TileIndex | tile | ) | `[static]`

Get the object associated with a tile.

Parameters:

  | tile | The tile to fetch the object for.

Returns:
  The object.

Definition at line 50 of file object_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_object_pool >::Get(), and GetObjectIndex().

Referenced by AnimateNewObjectTile(), CmdDeleteTown(), DrawNewObjectTile(), DrawTileLayout(), NIHObject::GetInstance(), NIHObject::GetParent(), ObjectScopeResolver::GetVariable(), IncreaseAnimationStage(), and NIHObject::Resolve().

static uint16 Object::GetTypeCount | ( | ObjectType | type | ) | `[inline, static]`

Get the count of objects for this type.

Parameters:

  | type | ObjectType to query

Precondition:
  type < NUM_OBJECTS

Definition at line 66 of file object_base.h.

References counts, and NUM_OBJECTS.

Referenced by GetCountAndDistanceOfClosestInstance().

static void Object::IncTypeCount | ( | ObjectType | type | ) | `[inline, static]`

Increment the count of objects for this type.

Parameters:

  | type | ObjectType to increment

Precondition:
  type < NUM_OBJECTS

Definition at line 44 of file object_base.h.

References counts, and NUM_OBJECTS.

Referenced by AfterLoadGame(), and BuildObject().

static void Object::ResetTypeCounts | ( |  | ) | `[inline, static]`

Resets object counts.

Definition at line 73 of file object_base.h.

References counts.

Referenced by InitializeObjects().

The documentation for this struct was generated from the following files:

- src/object_base.h
- src/object_cmd.cpp