* Count the sprites which originate from a specific file in a range of SpriteIDs. * @param file The loaded SpriteFile. * @param begin First sprite in range. * @param end First sprite not in range. * @return Number of sprites. */
| 174 | * @return Number of sprites. |
| 175 | */ |
| 176 | uint GetSpriteCountForFile(const std::string &filename, SpriteID begin, SpriteID end) |
| 177 | { |
| 178 | SpriteFile *file = GetCachedSpriteFileByName(filename); |
| 179 | if (file == nullptr) return 0; |
| 180 | |
| 181 | uint count = 0; |
| 182 | for (SpriteID i = begin; i != end; i++) { |
| 183 | if (SpriteExists(i)) { |
| 184 | SpriteCache *sc = GetSpriteCache(i); |
| 185 | if (sc->file == file) { |
| 186 | count++; |
| 187 | Debug(sprite, 4, "Sprite: {}", i); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | return count; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Get a reasonable (upper bound) estimate of the maximum |
no test coverage detected