Public Member Functions | Static Public Member Functions | Data Fields

# ObjectSpec Struct Reference

Allow incrementing of ObjectClassID variables. More...

`#include <newgrf_object.h>`

## Public Member Functions
Money | GetBuildCost () const
| Get the cost for building a structure of this type.
Money | GetClearCost () const
| Get the cost for clearing a structure of this type.
bool | IsAvailable () const
| Check whether the object is available at this time.
uint | Index () const
| Gets the index of this spec.
## Static Public Member Functions
static const ObjectSpec * | Get (ObjectType index)
| Get the specification associated with a specific ObjectType.
static const ObjectSpec * | GetByTile (TileIndex tile)
| Get the specification associated with a tile.
## Data Fields
GRFFilePropsBase< 2 > | grf_prop
| Properties related the the grf file.
ObjectClassID | cls_id
| The class to which this spec belongs.
StringID | name
| The name for this object.
uint8 | climate
| In which climates is this object available?
uint8 | size
| The size of this objects; low nibble for X, high nibble for Y.
uint8 | build_cost_multiplier
| Build cost multiplier per tile.
uint8 | clear_cost_multiplier
| Clear cost multiplier per tile.
Date | introduction_date
| From when can this object be built.
Date | end_of_life_date
| When can't this object be built anymore.
ObjectFlags | flags
| Flags/settings related to the object.
AnimationInfo | animation
| Information about the animation.
uint16 | callback_mask
| Bitmask of requested/allowed callbacks.
uint8 | height
| The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
uint8 | views
| The number of views.
bool | enabled
| Is this spec enabled?

## Detailed Description

Allow incrementing of ObjectClassID variables.

An object that isn't use for transport, industries or houses.

Definition at line 54 of file newgrf_object.h.

## Member Function Documentation

const ObjectSpec * ObjectSpec::Get | ( | ObjectType | index | ) | `[static]`

Get the specification associated with a specific ObjectType.

Parameters:

  | index | The object type to fetch.

Returns:
  The specification.

Definition at line 40 of file newgrf_object.cpp.

References NUM_OBJECTS.

Referenced by BuildObject(), CmdBuildObject(), GetByTile(), and BuildObjectWindow::UpdateWidgetSize().

Money ObjectSpec::GetBuildCost | ( |  | ) | const`[inline]`

Get the cost for building a structure of this type.

Returns:
  The cost for building.

Definition at line 77 of file newgrf_object.h.

References GetPrice(), and GRFFilePropsBase< Tcnt >::grffile.

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

Get the specification associated with a tile.

Parameters:

  | tile | The tile to fetch the data for.

Returns:
  The specification.

Definition at line 51 of file newgrf_object.cpp.

References Get(), and GetObjectType().

Referenced by AnimateNewObjectTile(), CmdBuildBridge(), NIHObject::GetGRFID(), GetObjectIDAtOffset(), GetObjectResolver(), NIHObject::GetSpec(), NIHObject::IsInspectable(), and UpdateObjectColours().

Money ObjectSpec::GetClearCost | ( |  | ) | const`[inline]`

Get the cost for clearing a structure of this type.

Returns:
  The cost for clearing.

Definition at line 83 of file newgrf_object.h.

References GetPrice(), and GRFFilePropsBase< Tcnt >::grffile.

uint ObjectSpec::Index | ( |  | ) | const

Gets the index of this spec.

Returns:
  The index.

Definition at line 72 of file newgrf_object.cpp.

bool ObjectSpec::IsAvailable | ( |  | ) | const

Check whether the object is available at this time.

Returns:
  true if it is available.

Definition at line 60 of file newgrf_object.cpp.

References _date, _settings_game, climate, enabled, end_of_life_date, flags, GameSettings::game_creation, HasBit(), introduction_date, GameCreationSettings::landscape, and OBJECT_FLAG_ONLY_IN_SCENEDIT.

Referenced by CmdBuildObject(), BuildObjectWindow::DrawWidget(), BuildObjectWindow::OnClick(), and BuildObjectWindow::SelectFirstAvailableObject().

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

- src/newgrf_object.h
- src/newgrf_object.cpp