mirror of https://github.com/OpenTTD/OpenTTD
(svn r6155) -Codechange: split Destroy routine from SpriteGroupPoolCleanBlock
Last change is to prepare for new pool system.release/0.5
parent
5d991a87d4
commit
b3cf0189a3
|
@ -16,14 +16,8 @@ enum {
|
||||||
static uint _spritegroup_count = 0;
|
static uint _spritegroup_count = 0;
|
||||||
static MemoryPool _spritegroup_pool;
|
static MemoryPool _spritegroup_pool;
|
||||||
|
|
||||||
|
void DestroySpriteGroup(SpriteGroup *group)
|
||||||
static void SpriteGroupPoolCleanBlock(uint start_item, uint end_item)
|
|
||||||
{
|
{
|
||||||
uint i;
|
|
||||||
|
|
||||||
for (i = start_item; i <= end_item; i++) {
|
|
||||||
SpriteGroup *group = (SpriteGroup*)GetItemFromPool(&_spritegroup_pool, i);
|
|
||||||
|
|
||||||
/* Free dynamically allocated memory */
|
/* Free dynamically allocated memory */
|
||||||
switch (group->type) {
|
switch (group->type) {
|
||||||
case SGT_REAL:
|
case SGT_REAL:
|
||||||
|
@ -44,8 +38,15 @@ static void SpriteGroupPoolCleanBlock(uint start_item, uint end_item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
static void SpriteGroupPoolCleanBlock(uint start_item, uint end_item)
|
||||||
|
{
|
||||||
|
uint i;
|
||||||
|
|
||||||
|
for (i = start_item; i <= end_item; i++) {
|
||||||
|
DestroySpriteGroup((SpriteGroup*)GetItemFromPool(&_spritegroup_pool, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the SpriteGroup pool */
|
/* Initialize the SpriteGroup pool */
|
||||||
static MemoryPool _spritegroup_pool = { "SpriteGr", SPRITEGROUP_POOL_MAX_BLOCKS, SPRITEGROUP_POOL_BLOCK_SIZE_BITS, sizeof(SpriteGroup), NULL, &SpriteGroupPoolCleanBlock, 0, 0, NULL };
|
static MemoryPool _spritegroup_pool = { "SpriteGr", SPRITEGROUP_POOL_MAX_BLOCKS, SPRITEGROUP_POOL_BLOCK_SIZE_BITS, sizeof(SpriteGroup), NULL, &SpriteGroupPoolCleanBlock, 0, 0, NULL };
|
||||||
|
|
Loading…
Reference in New Issue