summaryrefslogtreecommitdiff
path: root/src/gfxinit.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-20 21:39:50 +0000
committerrubidium <rubidium@openttd.org>2007-10-20 21:39:50 +0000
commit1d9542ce2d69ddccdf6c03ca5936e33b7107ef54 (patch)
treebde509eab266c280a8bc2b89c5cefb919aee7a8e /src/gfxinit.cpp
parentd1a51ebb36c8e217c3c3ea6844532202bd2dd1c4 (diff)
downloadopenttd-1d9542ce2d69ddccdf6c03ca5936e33b7107ef54.tar.xz
(svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r--src/gfxinit.cpp27
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)