summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-06-04 20:42:49 +0000
committerpeter1138 <peter1138@openttd.org>2007-06-04 20:42:49 +0000
commit18b98ad6aa4b22ce8b9dc73799401d388474a7af (patch)
tree698c3e384d6cfa1d6a8f106114bab3ce5d9498d1
parent32a04368b3df96642420815acef9a9d752fe0d79 (diff)
downloadopenttd-18b98ad6aa4b22ce8b9dc73799401d388474a7af.tar.xz
(svn r10038) -Fix (r8634): Sprite resulting from '?' substitution was reloaded into the cache entry for SPR_IMG_QUERY instead of the original sprite cache entry. This resulted in unaccounted missing sprite cache memory, and was exacerbated because the original missing sprite was not cached, so it did it again and again and again. Slowdowns and boom. Etc.
-rw-r--r--src/spritecache.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 431df4f9a..50d880dd3 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -121,6 +121,7 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id)
{
uint num;
byte type;
+ uint32 file_pos = sc->file_pos;
DEBUG(sprite, 9, "Load sprite %d", id);
@@ -129,10 +130,10 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id)
/* SPR_IMG_QUERY is a BIG FAT RED ? */
id = SPR_IMG_QUERY;
- sc = GetSpriteCache(SPR_IMG_QUERY);
+ file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
}
- FioSeekToFile(sc->file_pos);
+ FioSeekToFile(file_pos);
num = FioReadWord();
type = FioReadByte();