summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-07 02:29:08 +0000
committerrubidium <rubidium@openttd.org>2009-02-07 02:29:08 +0000
commit73d74386109677a22704acdea7e57a0bcd7f6823 (patch)
treee933e942c25345feb0391900ec0572993a7ad0c2
parentc4391379d267730f0b9cdcf29b82eec5bd707fb6 (diff)
downloadopenttd-73d74386109677a22704acdea7e57a0bcd7f6823.tar.xz
(svn r15391) -Fix (r14997): loading font sprites should not trigger a palette conversion.
-rw-r--r--src/spritecache.cpp7
1 files 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;