|
@@ -47,51 +47,51 @@ struct Object : ObjectPool::PoolItem<&_o
|
|
|
assert(type < NUM_OBJECTS);
|
|
|
counts[type]++;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Decrement the count of objects for this type.
|
|
|
* @param type ObjectType to decrement
|
|
|
* @pre type < NUM_OBJECTS
|
|
|
*/
|
|
|
static inline void DecTypeCount(ObjectType type)
|
|
|
{
|
|
|
assert(type < NUM_OBJECTS);
|
|
|
counts[type]--;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the count of objects for this type.
|
|
|
* @param type ObjectType to query
|
|
|
* @pre type < NUM_OBJECTS
|
|
|
*/
|
|
|
static inline uint16 GetTypeCount(ObjectType type)
|
|
|
{
|
|
|
assert(type < NUM_OBJECTS);
|
|
|
return counts[type];
|
|
|
}
|
|
|
|
|
|
/** Resets object counts. */
|
|
|
static inline void ResetTypeCounts()
|
|
|
{
|
|
|
memset(&counts, 0, sizeof(counts));
|
|
|
}
|
|
|
|
|
|
protected:
|
|
|
static uint16 counts[NUM_OBJECTS]; ///< Number of objects per type ingame
|
|
|
};
|
|
|
|
|
|
#define FOR_ALL_OBJECTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Object, object_index, var, start)
|
|
|
#define FOR_ALL_OBJECTS(var) FOR_ALL_OBJECTS_FROM(var, 0)
|
|
|
|
|
|
/**
|
|
|
* Keeps track of removed objects during execution/testruns of commands.
|
|
|
*/
|
|
|
struct ClearedObjectArea {
|
|
|
TileIndex first_tile; ///< The first tile being cleared, which then causes the whole object to be cleared.
|
|
|
TileArea area; ///< The area of the object.
|
|
|
};
|
|
|
|
|
|
ClearedObjectArea *FindClearedObject(TileIndex tile);
|
|
|
extern SmallVector<ClearedObjectArea, 4> _cleared_object_areas;
|
|
|
extern std::vector<ClearedObjectArea> _cleared_object_areas;
|
|
|
|
|
|
#endif /* OBJECT_BASE_H */
|