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

Function SkipSpriteData

src/spritecache.cpp:104–124  ·  view source on GitHub ↗

* Skip the given amount of sprite graphics data. * @param type the type of sprite (compressed etc) * @param num the amount of sprites to skip * @return true if the data could be correctly skipped. */

Source from the content-addressed store, hash-verified

102 * @return true if the data could be correctly skipped.
103 */
104bool SkipSpriteData(SpriteFile &file, uint8_t type, uint16_t num)
105{
106 if (type & 2) {
107 file.SkipBytes(num);
108 } else {
109 while (num > 0) {
110 int8_t i = file.ReadByte();
111 if (i >= 0) {
112 int size = (i == 0) ? 0x80 : i;
113 if (size > num) return false;
114 num -= size;
115 file.SkipBytes(size);
116 } else {
117 i = -(i >> 3);
118 num -= i;
119 file.ReadByte();
120 }
121 }
122 }
123 return true;
124}
125
126/* Check if the given Sprite ID exists */
127bool SpriteExists(SpriteID id)

Callers 3

LoadNewGRFFileFromFileFunction · 0.85
LoadNextSpriteFunction · 0.85
GRFSoundFunction · 0.85

Calls 2

SkipBytesMethod · 0.80
ReadByteMethod · 0.45

Tested by

no test coverage detected