summaryrefslogtreecommitdiff
path: root/src/spritecache.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2017-01-14 18:30:26 +0000
committerfrosch <frosch@openttd.org>2017-01-14 18:30:26 +0000
commit7b553d255ee5a5e5be3e4c1c8a0d56504cfdc418 (patch)
tree8cb6fcf4083fcf3e98864fbb40f7e323706f90d7 /src/spritecache.cpp
parent08b4255b677259e3e3f9039b903bd5a62a909da6 (diff)
downloadopenttd-7b553d255ee5a5e5be3e4c1c8a0d56504cfdc418.tar.xz
(svn r27732) -Change: Turn the message about 'missing baseset sprites' from a popup into a static message that only shows in non-release versions, just like the 'missing translations' message.
Diffstat (limited to 'src/spritecache.cpp')
-rw-r--r--src/spritecache.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 908e7599a..70a8834a9 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -150,6 +150,25 @@ uint GetOriginFileSlot(SpriteID sprite)
}
/**
+ * Count the sprites which originate from a specific file slot in a range of SpriteIDs.
+ * @param file_slot FIOS file slot.
+ * @param begin First sprite in range.
+ * @param end First sprite not in range.
+ * @return Number of sprites.
+ */
+uint GetSpriteCountForSlot(uint file_slot, SpriteID begin, SpriteID end)
+{
+ uint count = 0;
+ for (SpriteID i = begin; i != end; i++) {
+ if (SpriteExists(i)) {
+ SpriteCache *sc = GetSpriteCache(i);
+ if (sc->file_slot == file_slot) count++;
+ }
+ }
+ return count;
+}
+
+/**
* Get a reasonable (upper bound) estimate of the maximum
* SpriteID used in OpenTTD; there will be no sprites with
* a higher SpriteID, although there might be up to roughly