From bab7367a592ba3b625e350d66610fc210dbac275 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 7 Feb 2009 02:29:08 +0000 Subject: (svn r15391) -Fix (r14997): loading font sprites should not trigger a palette conversion. --- src/spritecache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/spritecache.cpp b/src/spritecache.cpp index d38090255..2c139fbc0 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -246,7 +246,7 @@ static void *ReadSprite(SpriteCache *sc, SpriteID id, SpriteType sprite_type) return sc->ptr; } - assert(sprite_type == ST_NORMAL); + assert(sprite_type == ST_NORMAL || sprite_type == ST_FONT); SpriteLoaderGrf sprite_loader; SpriteLoader::Sprite sprite; @@ -490,7 +490,10 @@ static const void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType reques }; SpriteType available = sc->type; - if (requested == ST_FONT && available == ST_NORMAL) return GetRawSprite(sprite, ST_NORMAL); + if (requested == ST_FONT && available == ST_NORMAL) { + if (sc->ptr == NULL) sc->type = ST_FONT; + return GetRawSprite(sprite, sc->type); + } byte warning_level = sc->warned ? 6 : 0; sc->warned = true; -- cgit v1.2.3-70-g09d2