(svn r3016) -NewGRF: Implement the start of reference counting for sprite groups. This will allow unloading.

This commit is contained in:
2005-10-04 20:58:10 +00:00
parent d1591e864d
commit c655e13e92
3 changed files with 15 additions and 2 deletions

View File

@@ -266,6 +266,7 @@ void SetWagonOverrideSprites(EngineID engine, SpriteGroup *group, byte *train_id
* to prevent leaks. But first we need to refcount the SpriteGroup.
* --pasky */
wo->group = group;
group->ref_count++;
wo->trains = trains;
wo->train_id = malloc(trains);
memcpy(wo->train_id, train_id, trains);
@@ -306,6 +307,7 @@ void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group)
* to prevent leaks. But first we need to refcount the SpriteGroup.
* --pasky */
engine_custom_sprites[engine][cargo] = group;
group->ref_count++;
}
typedef SpriteGroup *(*resolve_callback)(const SpriteGroup *spritegroup,