summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-14 07:59:16 +0000
committertron <tron@openttd.org>2005-10-14 07:59:16 +0000
commite0af0e30cac319064f0dfd68600c0c7eb13439bb (patch)
treeffe4c0c1fb0c9fdd5982a1d201fed6885aa8df85
parent4529d1fc8ea69c9809f9679323346b4da8a32fe2 (diff)
downloadopenttd-e0af0e30cac319064f0dfd68600c0c7eb13439bb.tar.xz
(svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
-rw-r--r--gfxinit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gfxinit.c b/gfxinit.c
index cfe15a88d..8dec7f784 100644
--- a/gfxinit.c
+++ b/gfxinit.c
@@ -326,8 +326,6 @@ static void LoadSpriteTables(void)
load_index += LoadGrfFile(files->basic[i].filename, load_index, i);
}
- LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++);
-
if (_sprite_page_to_load != 0) {
LoadGrfIndexed(
files->landscape[_sprite_page_to_load - 1].filename,
@@ -336,14 +334,20 @@ static void LoadSpriteTables(void)
);
}
+ assert(load_index == SPR_CANALS_BASE);
+ load_index += LoadGrfFile("canalsw.grf", load_index, i++);
+
+ assert(load_index == SPR_SLOPES_BASE);
LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++);
load_index = SPR_AUTORAIL_BASE;
load_index += LoadGrfFile("autorail.grf", load_index, i++);
- load_index = SPR_CANALS_BASE;
- load_index += LoadGrfFile("canalsw.grf", load_index, i++);
+ assert(load_index == SPR_ELRAIL_BASE);
+ load_index += LoadGrfFile("elrailsw.grf", load_index, i++);
+ assert(load_index == SPR_OPENTTD_BASE);
+ LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++);
load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT + 1;
LoadNewGRF(load_index, i);