summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-10-06 19:40:40 +0000
committerfrosch <frosch@openttd.org>2013-10-06 19:40:40 +0000
commit1e0dd39075a211e3104262264e00025cac9f242a (patch)
treee3977d937fe1e5a0dbc59ddd6b5bfb72e86f78ef
parent640d39c001982e6bba7034b75ae0adef3ea4b9bb (diff)
downloadopenttd-1e0dd39075a211e3104262264e00025cac9f242a.tar.xz
(svn r25821) -Fix-ish: Sprite 0 was considered available, even if no baseset was loaded.
-rw-r--r--src/spritecache.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 3ddcaaf36..3ffd74a8c 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -118,9 +118,10 @@ bool SkipSpriteData(byte type, uint16 num)
/* Check if the given Sprite ID exists */
bool SpriteExists(SpriteID id)
{
+ if (id >= _spritecache_items) return false;
+
/* Special case for Sprite ID zero -- its position is also 0... */
if (id == 0) return true;
- if (id >= _spritecache_items) return false;
return !(GetSpriteCache(id)->file_pos == 0 && GetSpriteCache(id)->file_slot == 0);
}