diff options
author | rubidium <rubidium@openttd.org> | 2009-05-17 14:32:13 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-17 14:32:13 +0000 |
commit | 10ea72a08e52cf9aaa54551ce201a6091316d47a (patch) | |
tree | b8eb240490c0c0a85b231fea6102db48f68862b5 /src/newgrf_spritegroup.h | |
parent | 76784501a8aacb3a4096310e61c85d9ca82e6044 (diff) | |
download | openttd-10ea72a08e52cf9aaa54551ce201a6091316d47a.tar.xz |
(svn r16336) -Codechange: make the SpriteGroup pool more like the 'normal' pools
Diffstat (limited to 'src/newgrf_spritegroup.h')
-rw-r--r-- | src/newgrf_spritegroup.h | 19 |
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 { |