|
|
|
@ -43,6 +43,7 @@ struct Object : ObjectPool::PoolItem<&_object_pool> {
|
|
|
|
|
static inline void IncTypeCount(ObjectType type)
|
|
|
|
|
{
|
|
|
|
|
dbg_assert(type < NUM_OBJECTS);
|
|
|
|
|
if (type >= counts.size()) counts.resize(type + 1);
|
|
|
|
|
counts[type]++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -54,6 +55,7 @@ struct Object : ObjectPool::PoolItem<&_object_pool> {
|
|
|
|
|
static inline void DecTypeCount(ObjectType type)
|
|
|
|
|
{
|
|
|
|
|
dbg_assert(type < NUM_OBJECTS);
|
|
|
|
|
dbg_assert(type < counts.size());
|
|
|
|
|
counts[type]--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -65,17 +67,18 @@ struct Object : ObjectPool::PoolItem<&_object_pool> {
|
|
|
|
|
static inline uint16 GetTypeCount(ObjectType type)
|
|
|
|
|
{
|
|
|
|
|
dbg_assert(type < NUM_OBJECTS);
|
|
|
|
|
if (type >= counts.size()) return 0;
|
|
|
|
|
return counts[type];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Resets object counts. */
|
|
|
|
|
static inline void ResetTypeCounts()
|
|
|
|
|
{
|
|
|
|
|
memset(&counts, 0, sizeof(counts));
|
|
|
|
|
counts.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
static uint16 counts[NUM_OBJECTS]; ///< Number of objects per type ingame
|
|
|
|
|
static std::vector<uint16> counts; ///< Number of objects per type ingame
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|