Change: Treat recolour sprites as regular sprites in the SpriteCache. (#13107)

Recolour sprites are loaded when seen, instead of being loaded when needed. This could result in the sprite cache being filled up with recolour sprites, and also mean that replacing recolour sprites didn't release the previously allocated memory.

Instead, allow recolour sprites to be loaded as needed and freed when unneeded, like regular sprites.
This commit is contained in:
2024-11-23 12:14:46 +00:00
committed by GitHub
parent 00ae20fa02
commit b890dab2b4
2 changed files with 17 additions and 6 deletions

View File

@@ -24,6 +24,7 @@ struct SpriteCache {
void *ptr;
size_t file_pos;
SpriteFile *file; ///< The file the sprite in this entry can be found in.
uint32_t length; ///< Length of sprite data.
uint32_t id;
int16_t lru;
SpriteType type; ///< In some cases a single sprite is misused by two NewGRFs. Once as real sprite and once as recolour sprite. If the recolour sprite gets into the cache it might be drawn as real sprite which causes enormous trouble.