src/gfxinit.cpp
author peter1138
Tue, 22 Jan 2008 07:27:06 +0000
changeset 8374 7a1b6c89cb89
parent 8270 e7c342f6b14c
child 8375 c84b6f2337dd
permissions -rw-r--r--
(svn r11940) -Codechange: Store short filename once per open file instead of once per sprite cache entry. Not all file types need this, but most of the time no sprite cache entry needed it either.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
     3
/** @file gfxinit.cpp */
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1844
diff changeset
     6
#include "openttd.h"
1299
39c06aba09aa (svn r1803) Move debugging stuff into files of it's own
tron
parents: 1250
diff changeset
     7
#include "debug.h"
2340
e18ef06bc59a (svn r2866) Move all functions and tables which aren't directly involved in managing the sprite heap to a new file gfxinit.c.
tron
parents: 2339
diff changeset
     8
#include "gfxinit.h"
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents: 1348
diff changeset
     9
#include "spritecache.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
#include "fileio.h"
7805
7ab20f94cc80 (svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents: 7800
diff changeset
    11
#include "fios.h"
463
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 452
diff changeset
    12
#include "newgrf.h"
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    13
#include "md5.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2142
diff changeset
    14
#include "variables.h"
5156
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
    15
#include "fontcache.h"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
    16
#include "gfx_func.h"
8213
7bdd7593eb9b (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents: 8133
diff changeset
    17
#include "core/alloc_func.hpp"
8236
8a5dd0b42e47 (svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents: 8214
diff changeset
    18
#include "core/bitmath_func.hpp"
4472
93758d1da52d (svn r6257) Use memcmp() to check the MD5 sum instead of using a home brewed loop
tron
parents: 4209
diff changeset
    19
#include <string.h>
8270
e7c342f6b14c (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8264
diff changeset
    20
#include "settings_type.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8236
diff changeset
    22
#include "table/sprites.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8236
diff changeset
    23
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    24
struct MD5File {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
    25
	const char * filename;     ///< filename
8133
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
    26
	uint8 hash[16];            ///< md5 sum of the file
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    27
};
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    28
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    29
struct FileList {
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
    30
	MD5File basic[2];     ///< GRF files that always have to be loaded
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
    31
	MD5File landscape[3]; ///< Landscape specific grf files
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
    32
	MD5File sound;        ///< Sound samples
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
    33
	MD5File chars;        ///< GRF File with character replacements
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
    34
	MD5File openttd;      ///< GRF File with OTTD specific graphics
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    35
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    37
#include "table/files.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
#include "table/landscape_sprite.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    40
static const SpriteID * const _landscape_spriteindexes[] = {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
	_landscape_spriteindexes_1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
	_landscape_spriteindexes_2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
	_landscape_spriteindexes_3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
    46
static uint LoadGrfFile(const char *filename, uint load_index, int file_index)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
{
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    48
	uint load_index_org = load_index;
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    49
	uint sprite_id = 0;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
	FioOpenFile(file_index, filename);
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    52
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
    53
	DEBUG(sprite, 2, "Reading grf-file '%s'", filename);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    55
	while (LoadNextSprite(load_index, file_index, sprite_id)) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
		load_index++;
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    57
		sprite_id++;
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    58
		if (load_index >= MAX_SPRITES) {
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    59
			error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
	}
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
    62
	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    64
	return load_index - load_index_org;
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    65
}
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    66
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    67
7772
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    68
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl)
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    69
{
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    70
	uint start;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    71
	while ((start = *index_tbl++) != END) {
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    72
		uint end = *index_tbl++;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    73
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    74
		if (start == SKIP) { // skip sprites (amount in second var)
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    75
			SkipSprites(end);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    76
			(*sprite_id) += end;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    77
		} else { // load sprites and use indexes from start to end
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    78
			do {
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    79
			#ifdef NDEBUG
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    80
				LoadNextSprite(start, file_index, *sprite_id);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    81
			#else
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    82
				bool b = LoadNextSprite(start, file_index, *sprite_id);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    83
				assert(b);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    84
			#endif
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    85
				(*sprite_id)++;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    86
			} while (++start <= end);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    87
		}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    88
	}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    89
}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    90
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    91
static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index)
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    92
{
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    93
	uint sprite_id = 0;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
    94
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    95
	FioOpenFile(file_index, filename);
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    96
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
    97
	DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
7772
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    99
	LoadSpritesIndexed(file_index, &sprite_id, index_tbl);
184
dbeaaaf8b2bb (svn r185) -Fix: [1016954] Cached_sprites does now work again
truelight
parents: 182
diff changeset
   100
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   102
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   103
/**
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   104
 * Calculate and check the MD5 hash of the supplied filename.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   105
 * @param file filename and expected MD5 hash for the given filename.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   106
 * @return true if the checksum is correct.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   107
 */
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   108
static bool FileMD5(const MD5File file)
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   109
{
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   110
	size_t size;
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   111
	FILE *f = FioFOpenFile(file.filename, "rb", DATA_DIR, &size);
5482
0528f1dfb732 (svn r7766) -Fix: [OSX] removed incorrect debug message about corrupted/missing grf files
bjarni
parents: 5475
diff changeset
   112
862
9baf2b0cdb18 (svn r1343) -Fix: [Graphic] Autorail icon is now correct (Darkvater)
truelight
parents: 614
diff changeset
   113
	if (f != NULL) {
8133
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
   114
		Md5 checksum;
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
   115
		uint8 buffer[1024];
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
   116
		uint8 digest[16];
2028
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   117
		size_t len;
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   118
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   119
		while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) {
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   120
			size -= len;
8133
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
   121
			checksum.Append(buffer, len);
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   122
		}
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   123
7592
792daecf7c77 (svn r11119) -Codechange: analyze .tar files upon loading, remembering their files and offsets, which speeds up .tar handling with a big factor
truelight
parents: 7574
diff changeset
   124
		FioFCloseFile(f);
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   125
8133
3ab8eaf85ca0 (svn r11695) -Codechange: Converted the md5 algorithm to OOP
skidd13
parents: 8131
diff changeset
   126
		checksum.Finish(digest);
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   127
		return memcmp(file.hash, digest, sizeof(file.hash)) == 0;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   128
	} else { // file not found
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   129
		return false;
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   130
	}
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   131
}
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   132
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   133
/**
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   134
 * Determine the palette that has to be used.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   135
 *  - forced DOS palette via command line -> leave it that way
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   136
 *  - all Windows files present -> Windows palette
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   137
 *  - all DOS files present -> DOS palette
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   138
 *  - no Windows files present and any DOS file present -> DOS palette
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   139
 *  - otherwise -> Windows palette
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   140
 */
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   141
static void DeterminePalette()
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   142
{
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   143
	if (_use_dos_palette) return;
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   144
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   145
	/* Count of files from the different versions. */
1355
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   146
	uint dos = 0;
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   147
	uint win = 0;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   148
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   149
	for (uint i = 0; i < lengthof(files_dos.basic); i++) if (FioCheckFileExists(files_dos.basic[i].filename)) dos++;
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   150
	for (uint i = 0; i < lengthof(files_dos.landscape); i++) if (FioCheckFileExists(files_dos.landscape[i].filename)) dos++;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   151
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   152
	for (uint i = 0; i < lengthof(files_win.basic); i++) if (FioCheckFileExists(files_win.basic[i].filename)) win++;
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   153
	for (uint i = 0; i < lengthof(files_win.landscape); i++) if (FioCheckFileExists(files_win.landscape[i].filename)) win++;
4934
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   154
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   155
	if (win == 5) {
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   156
		_use_dos_palette = false;
1381
6cfd0991443d (svn r1885) Fix typo in r1884
tron
parents: 1380
diff changeset
   157
	} else if (dos == 5 || (win == 0 && dos > 0)) {
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   158
		_use_dos_palette = true;
1380
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   159
	} else {
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   160
		_use_dos_palette = false;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   161
	}
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   162
}
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   163
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   164
/**
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   165
 * Checks whether the MD5 checksums of the files are correct.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   166
 *
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   167
 * @note Also checks sample.cat and other required non-NewGRF GRFs for corruption.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   168
 */
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   169
void CheckExternalFiles()
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   170
{
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   171
	DeterminePalette();
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   172
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   173
	static const size_t ERROR_MESSAGE_LENGTH = 128;
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   174
	const FileList *files = _use_dos_palette ? &files_dos : &files_win;
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   175
	char error_msg[ERROR_MESSAGE_LENGTH * (lengthof(files->basic) + lengthof(files->landscape) + 3)];
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   176
	error_msg[0] = '\0';
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   177
	char *add_pos = error_msg;
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   178
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   179
	for (uint i = 0; i < lengthof(files->basic); i++) {
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   180
		if (!FileMD5(files->basic[i])) {
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   181
			add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! You can find '%s' on your Transport Tycoon Deluxe CD-ROM.\n", files->basic[i].filename, files->basic[i].filename);
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   182
		}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   183
	}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   184
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   185
	for (uint i = 0; i < lengthof(files->landscape); i++) {
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   186
		if (!FileMD5(files->landscape[i])) {
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   187
			add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! You can find '%s' on your Transport Tycoon Deluxe CD-ROM.\n", files->landscape[i].filename, files->landscape[i].filename);
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   188
		}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   189
	}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   190
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   191
	if (!FileMD5(files_win.sound) && !FileMD5(files_dos.sound)) {
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   192
		add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your 'sample.cat' file is corrupted or missing! You can find 'sample.cat' on your Transport Tycoon Deluxe CD-ROM.\n");
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   193
	}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   194
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   195
	if (!FileMD5(files->chars)) {
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   196
		add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->chars.filename);
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   197
	}
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   198
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   199
	if (!FileMD5(files->openttd)) {
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   200
		add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->openttd.filename);
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   201
	}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   202
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   203
	if (add_pos != error_msg) ShowInfoF(error_msg);
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   204
}
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   205
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   206
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   207
static const SpriteID trg1idx[] = {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   208
	   0,    1, ///< Mouse cursor, ZZZ
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   209
/* Medium font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   210
	   2,   92, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   211
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   212
	 160,  160, ///< Move Ÿ to the correct position
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   213
	  98,   98, ///< Up arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   214
	 131,  133,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   215
	SKIP,    1, ///< skip currency sign
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   216
	 135,  135,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   217
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   218
	 137,  137,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   219
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   220
	 139,  139,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   221
	 140,  140, ///< @todo Down arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   222
	 141,  141,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   223
	 142,  142, ///< @todo Check mark
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   224
	 143,  143, ///< @todo Cross
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   225
	 144,  144,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   226
	 145,  145, ///< @todo Right arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   227
	 146,  149,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   228
	 118,  122, ///< Transport markers
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   229
	SKIP,    2,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   230
	 157,  157,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   231
	 114,  115, ///< Small up/down arrows
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   232
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   233
	 161,  225,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   234
/* Small font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   235
	 226,  316, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   236
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   237
	 384,  384, ///< Move Ÿ to the correct position
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   238
	 322,  322, ///< Up arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   239
	 355,  357,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   240
	SKIP,    1, ///< skip currency sign
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   241
	 359,  359,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   242
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   243
	 361,  361,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   244
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   245
	 363,  363,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   246
	 364,  364, ////< @todo Down arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   247
	 365,  366,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   248
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   249
	 368,  368,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   250
	 369,  369, ///< @todo Right arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   251
	 370,  373,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   252
	SKIP,    7,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   253
	 381,  381,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   254
	SKIP,    3,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   255
	 385,  449,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   256
/* Big font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   257
	 450,  540, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   258
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   259
	 608,  608, ///< Move Ÿ to the correct position
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   260
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   261
	 579,  581,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   262
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   263
	 583,  583,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   264
	SKIP,    5,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   265
	 589,  589,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   266
	SKIP,   15,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   267
	 605,  605,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   268
	SKIP,    3,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   269
	 609,  625,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   270
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   271
	 627,  632,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   272
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   273
	 634,  639,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   274
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   275
	 641,  657,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   276
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   277
	 659,  664,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   278
	SKIP,    2,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   279
	 667,  671,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   280
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   281
	 673,  673,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   282
/* Graphics */
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   283
	 674, 4792,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   284
	END
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   285
};
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   286
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   287
/** Replace some letter sprites with some other letters */
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   288
static const SpriteID _chars_grf_indexes[] = {
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   289
	134, 134, ///<  euro symbol medium size
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   290
	582, 582, ///<  euro symbol large size
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   291
	358, 358, ///<  euro symbol tiny
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   292
	648, 648, ///<  nordic char: æ
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   293
	616, 616, ///<  nordic char: Æ
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   294
	666, 666, ///<  nordic char: ø
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   295
	634, 634, ///<  nordic char: Ø
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   296
	382, 383, ///<  Œ œ tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   297
	158, 159, ///<  Œ œ medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   298
	606, 607, ///<  Œ œ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   299
	360, 360, ///<  Š tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   300
	362, 362, ///<  š tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   301
	136, 136, ///<  Š medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   302
	138, 138, ///<  š medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   303
	584, 584, ///<  Š large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   304
	586, 586, ///<  š large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   305
	626, 626, ///<  Ð large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   306
	658, 658, ///<  ð large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   307
	374, 374, ///<  Ž tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   308
	378, 378, ///<  ž tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   309
	150, 150, ///<  Ž medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   310
	154, 154, ///<  ž medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   311
	598, 598, ///<  Ž large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   312
	602, 602, ///<  ž large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   313
	640, 640, ///<  Þ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   314
	672, 672, ///<  þ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   315
	380, 380, ///<  º tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   316
	156, 156, ///<  º medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   317
	604, 604, ///<  º large
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   318
	317, 320, ///<  { | } ~ tiny
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   319
	 93,  96, ///<  { | } ~ medium
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   320
	541, 544, ///<  { | } ~ large
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   321
	585, 585, ///<  § large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   322
	587, 587, ///<  © large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   323
	592, 592, ///<  ® large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   324
	594, 597, ///<  ° ± ² ³ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   325
	633, 633, ///<  × large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   326
	665, 665, ///<  ÷ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   327
	377, 377, ///<  · small
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   328
	153, 153, ///<  · medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   329
	601, 601, ///<  · large
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   330
	END
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   331
};
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   332
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   333
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6179
diff changeset
   334
static void LoadSpriteTables()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   335
{
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   336
	const FileList *files = _use_dos_palette ? &files_dos : &files_win;
7805
7ab20f94cc80 (svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents: 7800
diff changeset
   337
	uint i = FIRST_GRF_SLOT;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   338
7805
7ab20f94cc80 (svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents: 7800
diff changeset
   339
	LoadGrfIndexed(files->basic[0].filename, trg1idx, i++);
2407
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   340
	DupSprite(  2, 130); // non-breaking space medium
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   341
	DupSprite(226, 354); // non-breaking space tiny
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   342
	DupSprite(450, 578); // non-breaking space large
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   343
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   344
	/*
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   345
	 * The second basic file always starts at the given location and does
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   346
	 * contain a different amount of sprites depending on the "type"; DOS
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   347
	 * has a few sprites less. However, we do not care about those missing
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   348
	 * sprites as they are not shown anyway (logos in intro game).
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   349
	 */
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   350
	LoadGrfFile(files->basic[1].filename, 4793, i++);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
7841
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   352
	/*
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   353
	 * Load additional sprites for climates other than temperate.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   354
	 * This overwrites some of the temperate sprites, such as foundations
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   355
	 * and the ground sprites.
8f9ab4f7064b (svn r11391) -Change: print all error messages related to missing/corrupted files in one message including the location where they can get said missing/corrupted files.
rubidium
parents: 7805
diff changeset
   356
	 */
6357
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   357
	if (_opt.landscape != LT_TEMPERATE) {
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   358
		LoadGrfIndexed(
5151
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   359
			files->landscape[_opt.landscape - 1].filename,
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   360
			_landscape_spriteindexes[_opt.landscape - 1],
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   361
			i++
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   362
		);
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   363
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   364
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   365
	LoadGrfIndexed(files->chars.filename, _chars_grf_indexes, i++);
6780
ba49b125d95e (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 6764
diff changeset
   366
5156
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   367
	/* Initialize the unicode to sprite mapping table */
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   368
	InitializeUnicodeGlyphMap();
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   369
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   370
	/*
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   371
	 * Load the base NewGRF with OTTD required graphics as first NewGRF.
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   372
	 * However, we do not want it to show up in the list of used NewGRFs,
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   373
	 * so we have to manually add it, and then remove it later.
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   374
	 */
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   375
	GRFConfig *top = _grfconfig;
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   376
	GRFConfig *master = CallocT<GRFConfig>(1);
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   377
	master->filename = strdup(files->openttd.filename);
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   378
	FillGRFDetails(master, false);
7929
6c9b25842b0f (svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13
parents: 7882
diff changeset
   379
	ClrBit(master->flags, GCF_INIT_ONLY);
7882
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   380
	master->next = top;
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   381
	_grfconfig = master;
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   382
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   383
	LoadNewGRF(SPR_NEWGRFS_BASE, i);
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   384
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   385
	/* Free and remove the top element. */
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   386
	ClearGRFConfig(&master);
308cab08d2f3 (svn r11433) -Fix: starting OpenTTD with DOS files made it look weird out of the box.
rubidium
parents: 7841
diff changeset
   387
	_grfconfig = top;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   388
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   389
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   390
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6179
diff changeset
   391
void GfxLoadSprites()
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1070
diff changeset
   392
{
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   393
	DEBUG(sprite, 2, "Loading sprite set %d", _opt.landscape);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   394
5151
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   395
	GfxInitSpriteMem();
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   396
	LoadSpriteTables();
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   397
	GfxInitPalettes();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   398
}