summaryrefslogtreecommitdiff
path: root/src/gfxinit.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-14 14:31:48 +0000
committertruelight <truelight@openttd.org>2007-06-14 14:31:48 +0000
commit5d55a9435b604c861b91c0bb64f4202a9006f384 (patch)
tree43097ea88db1a77b66a4f87c662fe744ac9a258d /src/gfxinit.cpp
parent083504c12e042fbc0b29ab881237d45cf434071d (diff)
downloadopenttd-5d55a9435b604c861b91c0bb64f4202a9006f384.tar.xz
(svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r--src/gfxinit.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 2fe58ca0b..6212badfd 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -53,13 +53,15 @@ static const SpriteID * const _slopes_spriteindexes[] = {
static uint LoadGrfFile(const char* filename, uint load_index, int file_index)
{
uint load_index_org = load_index;
+ uint sprite_id = 0;
FioOpenFile(file_index, filename);
DEBUG(sprite, 2, "Reading grf-file '%s'", filename);
- while (LoadNextSprite(load_index, file_index)) {
+ while (LoadNextSprite(load_index, file_index, sprite_id)) {
load_index++;
+ sprite_id++;
if (load_index >= MAX_SPRITES) {
error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
}
@@ -73,6 +75,7 @@ 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)
{
uint start;
+ uint sprite_id = 0;
FioOpenFile(file_index, filename);
@@ -83,14 +86,16 @@ static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int
if (start == SKIP) { // skip sprites (amount in second var)
SkipSprites(end);
+ sprite_id += end;
} else { // load sprites and use indexes from start to end
do {
#ifdef NDEBUG
- LoadNextSprite(start, file_index);
+ LoadNextSprite(start, file_index, sprite_id);
#else
- bool b = LoadNextSprite(start, file_index);
+ bool b = LoadNextSprite(start, file_index, sprite_id);
assert(b);
#endif
+ sprite_id++;
} while (++start <= end);
}
}