MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SpriteExists

Function SpriteExists

src/spritecache.cpp:127–134  ·  view source on GitHub ↗

Check if the given Sprite ID exists */

Source from the content-addressed store, hash-verified

125
126/* Check if the given Sprite ID exists */
127bool SpriteExists(SpriteID id)
128{
129 if (id >= _spritecache.size()) return false;
130
131 /* Special case for Sprite ID zero -- its position is also 0... */
132 if (id == 0) return true;
133 return !(GetSpriteCache(id)->file_pos == 0 && GetSpriteCache(id)->file == nullptr);
134}
135
136/**
137 * Get the sprite type of a given sprite.

Callers 8

GetSpriteTypeFunction · 0.85
GetOriginFileFunction · 0.85
GetSpriteLocalIDFunction · 0.85
GetSpriteCountForFileFunction · 0.85
GetRawSpriteFunction · 0.85
GetGlyphWidthMethod · 0.85

Calls 2

GetSpriteCacheFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected