diff options
author | rubidium <rubidium@openttd.org> | 2007-10-29 23:02:31 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-29 23:02:31 +0000 |
commit | b14c94867a121a5c6b9b69340953368aee8a8876 (patch) | |
tree | f4608f438da95909157f41aa78f5a878e7152382 /src/gfxinit.cpp | |
parent | 24956ab71ba1dd9ed1734ae262229f098662b275 (diff) | |
download | openttd-b14c94867a121a5c6b9b69340953368aee8a8876.tar.xz |
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r-- | src/gfxinit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index a04402bc3..b20a1b29d 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -11,6 +11,7 @@ #include "spritecache.h" #include "table/sprites.h" #include "fileio.h" +#include "fios.h" #include "string.h" #include "newgrf.h" #include "md5.h" @@ -333,16 +334,16 @@ static void LoadSpriteTables() { const FileList* files = _use_dos_palette ? &files_dos : &files_win; uint load_index; - uint i; + uint i = FIRST_GRF_SLOT; - LoadGrfIndexed(files->basic[0].filename, trg1idx, 0); + LoadGrfIndexed(files->basic[0].filename, trg1idx, i++); DupSprite( 2, 130); // non-breaking space medium DupSprite(226, 354); // non-breaking space tiny DupSprite(450, 578); // non-breaking space large load_index = 4793; - for (i = 1; files->basic[i].filename != NULL; i++) { - load_index += LoadGrfFile(files->basic[i].filename, load_index, i); + for (uint j = 1; files->basic[j].filename != NULL; j++) { + load_index += LoadGrfFile(files->basic[j].filename, load_index, i++); } /* Load additional sprites for climates other than temperate */ |