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
commitbab7367a592ba3b625e350d66610fc210dbac275 (patch)
treee933e942c25345feb0391900ec0572993a7ad0c2
parent322515e8d51381ef6681c7af5394d0a11e1e0bd3 (diff)
downloadopenttd-bab7367a592ba3b625e350d66610fc210dbac275.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;