(svn r16336) -Codechange: make the SpriteGroup pool more like the 'normal' pools

This commit is contained in:
rubidium
2009-05-17 14:32:13 +00:00
parent 76784501a8
commit 10ea72a08e
3 changed files with 35 additions and 63 deletions

View File

@@ -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,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;