summaryrefslogtreecommitdiff
path: root/src/newgrf_spritegroup.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_spritegroup.h')
-rw-r--r--src/newgrf_spritegroup.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h
index 0b83934d9..1e745480b 100644
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -11,6 +11,7 @@
#include "gfx_type.h"
#include "engine_type.h"
#include "tile_type.h"
+#include "oldpool.h"
#include "newgrf_cargo.h"
#include "newgrf_callbacks.h"
@@ -182,8 +183,18 @@ enum SpriteGroupType {
SGT_INDUSTRY_PRODUCTION,
};
+typedef uint32 SpriteGroupID;
+DECLARE_OLD_POOL(SpriteGroup, SpriteGroup, 9, 250)
+
/* Common wrapper for all the different sprite group types */
-struct SpriteGroup {
+struct SpriteGroup : PoolItem<SpriteGroup, SpriteGroupID, &_SpriteGroup_pool> {
+ SpriteGroup(SpriteGroupType type = SGT_INVALID) :
+ type(type)
+ {
+ }
+
+ ~SpriteGroup();
+
SpriteGroupType type;
union {
@@ -195,11 +206,9 @@ struct SpriteGroup {
TileLayoutSpriteGroup layout;
IndustryProductionSpriteGroup indprod;
} g;
-};
-
-SpriteGroup *AllocateSpriteGroup();
-void InitializeSpriteGroupPool();
+ inline bool IsValid() const { return this->type != SGT_INVALID; }
+};
struct ResolverObject {