diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h --- 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(SpriteGroupType type = SGT_INVALID) : + type(type) + { + } + + ~SpriteGroup(); + SpriteGroupType type; union { @@ -195,13 +206,11 @@ struct SpriteGroup { TileLayoutSpriteGroup layout; IndustryProductionSpriteGroup indprod; } g; + + inline bool IsValid() const { return this->type != SGT_INVALID; } }; -SpriteGroup *AllocateSpriteGroup(); -void InitializeSpriteGroupPool(); - - struct ResolverObject { CallbackID callback; uint32 callback_param1;