|
OpenTTD Source 20251117-master-g7398d2e290
|
An object, such as transmitter, on the map. More...
#include <object_base.h>
Public Member Functions | |
| Object () | |
| Make sure the object isn't zeroed. | |
| Object (ObjectType type, Town *town, TileArea location, TimerGameCalendar::Date build_date, uint8_t view) | |
| ~Object () | |
| Make sure the right destructor is called as well! | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_object_pool > | |
| void * | operator new (size_t size) |
| Allocates space for new Titem. | |
| void * | operator new (size_t size, Tindex index) |
| Allocates space for new Titem with given index. | |
| void * | operator new (size_t, void *ptr) |
| Allocates space for new Titem at given memory address. | |
| void | operator delete (void *p, size_t size) |
| Marks Titem as free. | |
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_t | GetTypeCount (ObjectType type) |
| Get the count of objects for this type. | |
| static void | ResetTypeCounts () |
| Resets object counts. | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_object_pool > | |
| static bool | CanAllocateItem (size_t n=1) |
| Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() | |
| static bool | CleaningPool () |
| Returns current state of pool cleaning - yes or no. | |
| static bool | IsValidID (auto index) |
| Tests whether given index can be used to get valid (non-nullptr) Titem. | |
| static Titem * | Get (auto index) |
| Returns Titem with given index. | |
| static Titem * | GetIfValid (auto index) |
| Returns Titem with given index. | |
| static size_t | GetPoolSize () |
| Returns first unused index. | |
| static size_t | GetNumItems () |
| Returns number of valid items in the pool. | |
| static void | PostDestructor (size_t index) |
| Dummy function called after destructor of each member. | |
| static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
| Returns an iterable ensemble of all valid Titem. | |
Data Fields | |
| ObjectType | type = INVALID_OBJECT_TYPE |
| Type of the object. | |
| Town * | town = nullptr |
| Town the object is built in. | |
| TileArea | location {INVALID_TILE, 0, 0} |
| Location of the object. | |
| TimerGameCalendar::Date | build_date {} |
| Date of construction. | |
| uint8_t | colour = 0 |
| Colour of the object, for display purpose. | |
| uint8_t | view = 0 |
| The view setting for this object. | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_object_pool > | |
| Tindex | index |
| Index of this pool item. | |
Static Protected Attributes | |
| static std::array< uint16_t, NUM_OBJECTS > | counts |
| Number of objects per type ingame. | |
Additional Inherited Members | |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_object_pool > | |
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool |
| Type of the pool this item is going to be part of. | |
An object, such as transmitter, on the map.
Definition at line 23 of file object_base.h.
|
inline |
Make sure the object isn't zeroed.
Definition at line 32 of file object_base.h.
|
inline |
Definition at line 33 of file object_base.h.
|
inline |
Make sure the right destructor is called as well!
Definition at line 36 of file object_base.h.
|
inlinestatic |
Decrement the count of objects for this type.
| type | ObjectType to decrement |
Definition at line 56 of file object_base.h.
References counts, NUM_OBJECTS, and type.
Referenced by ReallyClearObjectTile().
Get the object associated with a tile.
| tile | The tile to fetch the object for. |
Definition at line 55 of file object_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_object_pool >::Get(), and GetObjectIndex().
Referenced by AnimateNewObjectTile(), CmdDeleteTown(), DrawNewObjectTile(), DrawTileLayout(), NIHObject::GetInstance(), GetObjectIDAtOffset(), GetObjectType(), NIHObject::GetParent(), ObjectScopeResolver::GetVariable(), IncreaseCompanyHQSize(), and NIHObject::Resolve().
|
inlinestatic |
Get the count of objects for this type.
| type | ObjectType to query |
Definition at line 67 of file object_base.h.
References counts, NUM_OBJECTS, and type.
Referenced by GetCountAndDistanceOfClosestInstance().
|
inlinestatic |
Increment the count of objects for this type.
| type | ObjectType to increment |
Definition at line 45 of file object_base.h.
References counts, NUM_OBJECTS, and type.
Referenced by AfterLoadGame(), BuildObject(), and InitializeWindowsAndCaches().
|
inlinestatic |
Resets object counts.
Definition at line 74 of file object_base.h.
References counts.
Referenced by InitializeObjects().
| TimerGameCalendar::Date Object::build_date {} |
Date of construction.
Definition at line 27 of file object_base.h.
Referenced by AfterLoadGame(), and ObjectScopeResolver::GetVariable().
| uint8_t Object::colour = 0 |
Colour of the object, for display purpose.
Definition at line 28 of file object_base.h.
Referenced by BuildObject(), DrawTileLayout(), and ObjectScopeResolver::GetVariable().
|
staticprotected |
Number of objects per type ingame.
Definition at line 80 of file object_base.h.
Referenced by DecTypeCount(), GetTypeCount(), IncTypeCount(), and ResetTypeCounts().
| TileArea Object::location {INVALID_TILE, 0, 0} |
Location of the object.
Definition at line 26 of file object_base.h.
Referenced by AfterLoadGame(), ObjectScopeResolver::GetVariable(), IncreaseCompanyHQSize(), ReallyClearObjectTile(), and TriggerObjectAnimation().
| Town* Object::town = nullptr |
Town the object is built in.
Definition at line 25 of file object_base.h.
Referenced by AfterLoadGame(), BuildObject(), CmdDeleteTown(), ObjectResolverObject::GetTown(), and ObjectScopeResolver::GetVariable().
| ObjectType Object::type = INVALID_OBJECT_TYPE |
Type of the object.
Definition at line 24 of file object_base.h.
Referenced by AfterLoadGame(), CmdDeleteTown(), DecTypeCount(), GetObjectIDAtOffset(), GetObjectType(), GetTypeCount(), IncTypeCount(), and ReallyClearObjectTile().
| uint8_t Object::view = 0 |
The view setting for this object.
Definition at line 29 of file object_base.h.
Referenced by GetObjectIDAtOffset(), and ObjectScopeResolver::GetVariable().