summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-23 21:19:43 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-23 21:19:43 +0000
commit1ce4eda5761f37445e676c92ee3f0affbf4e8e79 (patch)
treeeb53353d39db99a771e2c6a49fd20f83817dcfa3
parent59723b113ed42a54855f096a56f58001583debfc (diff)
downloadopenttd-1ce4eda5761f37445e676c92ee3f0affbf4e8e79.tar.xz
(svn r7242) -Fix: Don't load 1-byte pseudo sprites, as used in some NewGRF sets. If the sprite is ever drawn this will result in a "missing sprite" error instead of undefined misbehaviour leading to segmentation faults...
-rw-r--r--spritecache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/spritecache.c b/spritecache.c
index 4604f7602..a27444ce1 100644
--- a/spritecache.c
+++ b/spritecache.c
@@ -45,7 +45,9 @@ static bool ReadSpriteHeaderSkipData(void)
type = FioReadByte();
if (type == 0xFF) {
FioSkipBytes(num);
- return true;
+ /* Some NewGRF files have "empty" pseudo-sprites which are 1
+ * byte long. Catch these so the sprites won't be displayed. */
+ return num != 1;
}
FioSkipBytes(7);