diff options
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r-- | src/gfxinit.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index f5263aad4..84a04f1b8 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -74,35 +74,40 @@ static uint LoadGrfFile(const char* filename, uint load_index, int file_index) } -static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index) +void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl) { uint start; - uint sprite_id = 0; - - FioOpenFile(file_index, filename); - - DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename); - while ((start = *index_tbl++) != END) { uint end = *index_tbl++; if (start == SKIP) { // skip sprites (amount in second var) SkipSprites(end); - sprite_id += end; + (*sprite_id) += end; } else { // load sprites and use indexes from start to end do { #ifdef NDEBUG - LoadNextSprite(start, file_index, sprite_id); + LoadNextSprite(start, file_index, *sprite_id); #else - bool b = LoadNextSprite(start, file_index, sprite_id); + bool b = LoadNextSprite(start, file_index, *sprite_id); assert(b); #endif - sprite_id++; + (*sprite_id)++; } while (++start <= end); } } } +static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index) +{ + uint sprite_id = 0; + + FioOpenFile(file_index, filename); + + DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename); + + LoadSpritesIndexed(file_index, &sprite_id, index_tbl); +} + /* Check that the supplied MD5 hash matches that stored for the supplied filename */ static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn) |