OpenTTD Source 20241224-master-gf74b0cf984
|
Allow incrementing of ObjectClassID variables. More...
#include <newgrf_object.h>
Public Member Functions | |
bool | IsEnabled () const |
Test if this object is enabled. | |
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 | IsEverAvailable () const |
Check whether the object might be available at some point in this game with the current game mode. | |
bool | WasEverAvailable () const |
Check whether the object was available at some point in the past or present in this game with the current game mode. | |
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 std::vector< ObjectSpec > & | Specs () |
static size_t | Count () |
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. | |
static void | BindToClasses () |
Tie all ObjectSpecs to their class. | |
Data Fields | |
GRFFilePropsBase< 2 > | grf_prop |
Properties related the the grf file. | |
AnimationInfo | animation |
Information about the animation. | |
StringID | name |
The name for this object. | |
uint8_t | climate |
In which climates is this object available? | |
uint8_t | size |
The size of this objects; low nibble for X, high nibble for Y. | |
uint8_t | build_cost_multiplier |
Build cost multiplier per tile. | |
uint8_t | clear_cost_multiplier |
Clear cost multiplier per tile. | |
TimerGameCalendar::Date | introduction_date |
From when can this object be built. | |
TimerGameCalendar::Date | end_of_life_date |
When can't this object be built anymore. | |
ObjectFlags | flags |
Flags/settings related to the object. | |
uint16_t | callback_mask |
Bitmask of requested/allowed callbacks. | |
uint8_t | height |
The height of this structure, in heightlevels; max MAX_TILE_HEIGHT. | |
uint8_t | views |
The number of views. | |
uint8_t | generate_amount |
Number of objects which are attempted to be generated per 256^2 map during world generation. | |
Data Fields inherited from NewGRFSpecBase< ObjectClassID > | |
ObjectClassID | class_index |
Class index of this spec, invalid until class is allocated. | |
uint16_t | index |
Index within class of this spec, invalid until inserted into class. | |
Allow incrementing of ObjectClassID variables.
An object that isn't use for transport, industries or houses.
Definition at line 60 of file newgrf_object.h.
|
static |
Tie all ObjectSpecs to their class.
Definition at line 111 of file newgrf_object.cpp.
References _object_specs, NewGRFClass< Tspec, Tindex, Tmax >::Assign(), and INVALID_OBJECT_CLASS.
Referenced by FinaliseObjectsArray().
|
static |
Definition at line 40 of file newgrf_object.cpp.
|
static |
Get the specification associated with a specific ObjectType.
index | The object type to fetch. |
Definition at line 50 of file newgrf_object.cpp.
References _object_specs, NewGRFSpecBase< ObjectClassID >::index, and NUM_OBJECTS.
Referenced by BuildObject(), CmdBuildObject(), CmdBuildObjectArea(), ObjectPickerCallbacks::FillUsedItems(), GetByTile(), and GetObjectIDAtOffset().
|
inline |
Get the cost for building a structure of this type.
Definition at line 88 of file newgrf_object.h.
References GetPrice(), and GRFFilePropsBase< Tcnt >::grffile.
Referenced by CmdBuildObject().
|
static |
Get the specification associated with a tile.
tile | The tile to fetch the data for. |
Definition at line 65 of file newgrf_object.cpp.
References Get(), and GetObjectType().
Referenced by AnimateNewObjectTile(), CmdBuildBridge(), NIHObject::GetGRFID(), NIHObject::GetSpec(), NIHObject::IsInspectable(), NIHObject::Resolve(), and UpdateObjectColours().
|
inline |
Get the cost for clearing a structure of this type.
Definition at line 94 of file newgrf_object.h.
References GetPrice(), and GRFFilePropsBase< Tcnt >::grffile.
uint ObjectSpec::Index | ( | ) | const |
Gets the index of this spec.
Definition at line 103 of file newgrf_object.cpp.
References _object_specs.
Referenced by BuildObjectWindow::OnPlaceMouseUp(), and BuildObjectWindow::OnPlaceObject().
bool ObjectSpec::IsAvailable | ( | ) | const |
Check whether the object is available at this time.
Definition at line 93 of file newgrf_object.cpp.
References TimerGameCalendar::date, end_of_life_date, introduction_date, and WasEverAvailable().
Referenced by CmdBuildObject().
|
inline |
Test if this object is enabled.
Definition at line 82 of file newgrf_object.h.
Referenced by IsEverAvailable().
bool ObjectSpec::IsEverAvailable | ( | ) | const |
Check whether the object might be available at some point in this game with the current game mode.
Definition at line 74 of file newgrf_object.cpp.
References _generating_world, _settings_game, climate, flags, GameSettings::game_creation, HasBit(), IsEnabled(), GameCreationSettings::landscape, OBJECT_FLAG_ONLY_IN_GAME, and OBJECT_FLAG_ONLY_IN_SCENEDIT.
Referenced by ObjectPickerCallbacks::FillUsedItems(), and WasEverAvailable().
|
static |
Definition at line 35 of file newgrf_object.cpp.
bool ObjectSpec::WasEverAvailable | ( | ) | const |
Check whether the object was available at some point in the past or present in this game with the current game mode.
Definition at line 84 of file newgrf_object.cpp.
References TimerGameCalendar::date, introduction_date, and IsEverAvailable().
Referenced by CmdBuildObject(), and IsAvailable().
AnimationInfo ObjectSpec::animation |
Information about the animation.
Definition at line 63 of file newgrf_object.h.
Referenced by TriggerObjectAnimation(), and TriggerObjectTileAnimation().
uint8_t ObjectSpec::build_cost_multiplier |
Build cost multiplier per tile.
Definition at line 68 of file newgrf_object.h.
uint16_t ObjectSpec::callback_mask |
Bitmask of requested/allowed callbacks.
Definition at line 73 of file newgrf_object.h.
Referenced by BuildObject(), CmdBuildObject(), BuildObjectWindow::DrawWidget(), and UpdateObjectColours().
uint8_t ObjectSpec::clear_cost_multiplier |
Clear cost multiplier per tile.
Definition at line 69 of file newgrf_object.h.
uint8_t ObjectSpec::climate |
In which climates is this object available?
Definition at line 66 of file newgrf_object.h.
Referenced by IsEverAvailable().
TimerGameCalendar::Date ObjectSpec::end_of_life_date |
When can't this object be built anymore.
Definition at line 71 of file newgrf_object.h.
Referenced by IsAvailable().
ObjectFlags ObjectSpec::flags |
Flags/settings related to the object.
Definition at line 72 of file newgrf_object.h.
Referenced by AnimateNewObjectTile(), BuildObject(), CmdBuildBridge(), CmdBuildObject(), DrawNewObjectTileInGUI(), DrawTileLayout(), IsEverAvailable(), and UpdateObjectColours().
uint8_t ObjectSpec::generate_amount |
Number of objects which are attempted to be generated per 256^2 map during world generation.
Definition at line 76 of file newgrf_object.h.
GRFFilePropsBase<2> ObjectSpec::grf_prop |
Properties related the the grf file.
Definition at line 62 of file newgrf_object.h.
Referenced by BuildObject(), CmdBuildObject(), BuildObjectWindow::DrawWidget(), ObjectResolverObject::GetDebugID(), NIHObject::GetGRFID(), GetObjectIDAtOffset(), NIHObject::IsInspectable(), ObjectResolverObject::ObjectResolverObject(), ResetObjects(), and ObjectOverrideManager::SetEntitySpec().
uint8_t ObjectSpec::height |
The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
Definition at line 74 of file newgrf_object.h.
Referenced by CmdBuildBridge(), and CmdBuildObject().
TimerGameCalendar::Date ObjectSpec::introduction_date |
From when can this object be built.
Definition at line 70 of file newgrf_object.h.
Referenced by IsAvailable(), and WasEverAvailable().
StringID ObjectSpec::name |
The name for this object.
Definition at line 64 of file newgrf_object.h.
uint8_t ObjectSpec::size |
The size of this objects; low nibble for X, high nibble for Y.
Definition at line 67 of file newgrf_object.h.
Referenced by BuildObject(), CmdBuildObject(), CmdBuildObjectArea(), BuildObjectWindow::OnPlaceObject(), and BuildObjectWindow::SetStringParameters().
uint8_t ObjectSpec::views |
The number of views.
Definition at line 75 of file newgrf_object.h.
Referenced by CmdBuildObject(), CmdBuildObjectArea(), BuildObjectWindow::OnInvalidateData(), and BuildObjectWindow::UpdateWidgetSize().