src/gfxinit.cpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6877 889301acc299
--- a/src/gfxinit.cpp	Mon Dec 03 23:39:38 2007 +0000
+++ b/src/gfxinit.cpp	Tue Jan 22 21:00:30 2008 +0000
@@ -5,30 +5,31 @@
 #include "stdafx.h"
 #include "openttd.h"
 #include "debug.h"
-#include "functions.h"
-#include "gfx.h"
 #include "gfxinit.h"
 #include "spritecache.h"
-#include "table/sprites.h"
 #include "fileio.h"
 #include "fios.h"
-#include "string.h"
 #include "newgrf.h"
 #include "md5.h"
 #include "variables.h"
 #include "fontcache.h"
+#include "gfx_func.h"
+#include "core/alloc_func.hpp"
+#include "core/bitmath_func.hpp"
 #include <string.h>
+#include "settings_type.h"
+
+#include "table/sprites.h"
 
 struct MD5File {
 	const char * filename;     ///< filename
-	md5_byte_t hash[16];       ///< md5 sum of the file
+	uint8 hash[16];            ///< md5 sum of the file
 };
 
 struct FileList {
 	MD5File basic[2];     ///< GRF files that always have to be loaded
 	MD5File landscape[3]; ///< Landscape specific grf files
 	MD5File sound;        ///< Sound samples
-	MD5File chars;        ///< GRF File with character replacements
 	MD5File openttd;      ///< GRF File with OTTD specific graphics
 };
 
@@ -109,20 +110,19 @@
 	FILE *f = FioFOpenFile(file.filename, "rb", DATA_DIR, &size);
 
 	if (f != NULL) {
-		md5_state_t filemd5state;
-		md5_byte_t buffer[1024];
-		md5_byte_t digest[16];
+		Md5 checksum;
+		uint8 buffer[1024];
+		uint8 digest[16];
 		size_t len;
 
-		md5_init(&filemd5state);
 		while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) {
 			size -= len;
-			md5_append(&filemd5state, buffer, len);
+			checksum.Append(buffer, len);
 		}
 
 		FioFCloseFile(f);
 
-		md5_finish(&filemd5state, digest);
+		checksum.Finish(digest);
 		return memcmp(file.hash, digest, sizeof(file.hash)) == 0;
 	} else { // file not found
 		return false;
@@ -191,10 +191,6 @@
 		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");
 	}
 
-	if (!FileMD5(files->chars)) {
-		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);
-	}
-
 	if (!FileMD5(files->openttd)) {
 		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);
 	}
@@ -283,53 +279,6 @@
 	END
 };
 
-/** Replace some letter sprites with some other letters */
-static const SpriteID _chars_grf_indexes[] = {
-	134, 134, ///<  euro symbol medium size
-	582, 582, ///<  euro symbol large size
-	358, 358, ///<  euro symbol tiny
-	648, 648, ///<  nordic char: æ
-	616, 616, ///<  nordic char: Æ
-	666, 666, ///<  nordic char: ø
-	634, 634, ///<  nordic char: Ø
-	382, 383, ///<  Œ œ tiny
-	158, 159, ///<  Œ œ medium
-	606, 607, ///<  Œ œ large
-	360, 360, ///<  Š tiny
-	362, 362, ///<  š tiny
-	136, 136, ///<  Š medium
-	138, 138, ///<  š medium
-	584, 584, ///<  Š large
-	586, 586, ///<  š large
-	626, 626, ///<  Ð large
-	658, 658, ///<  ð large
-	374, 374, ///<  Ž tiny
-	378, 378, ///<  ž tiny
-	150, 150, ///<  Ž medium
-	154, 154, ///<  ž medium
-	598, 598, ///<  Ž large
-	602, 602, ///<  ž large
-	640, 640, ///<  Þ large
-	672, 672, ///<  þ large
-	380, 380, ///<  º tiny
-	156, 156, ///<  º medium
-	604, 604, ///<  º large
-	317, 320, ///<  { | } ~ tiny
-	 93,  96, ///<  { | } ~ medium
-	541, 544, ///<  { | } ~ large
-	585, 585, ///<  § large
-	587, 587, ///<  © large
-	592, 592, ///<  ® large
-	594, 597, ///<  ° ± ² ³ large
-	633, 633, ///<  × large
-	665, 665, ///<  ÷ large
-	377, 377, ///<  · small
-	153, 153, ///<  · medium
-	601, 601, ///<  · large
-	END
-};
-
-
 static void LoadSpriteTables()
 {
 	const FileList *files = _use_dos_palette ? &files_dos : &files_win;
@@ -361,8 +310,6 @@
 		);
 	}
 
-	LoadGrfIndexed(files->chars.filename, _chars_grf_indexes, i++);
-
 	/* Initialize the unicode to sprite mapping table */
 	InitializeUnicodeGlyphMap();