(svn r10170) -Codechange: remove some duplication of code.
authorrubidium
Sat, 16 Jun 2007 12:03:36 +0000
changeset 7413 eadff82c1b45
parent 7412 e235043a56db
child 7414 54c0982e17ab
(svn r10170) -Codechange: remove some duplication of code.
projects/openttd.vcproj
projects/openttd_vs80.vcproj
source.list
src/gfxinit.cpp
--- a/projects/openttd.vcproj	Sat Jun 16 11:13:30 2007 +0000
+++ b/projects/openttd.vcproj	Sat Jun 16 12:03:36 2007 +0000
@@ -989,14 +989,14 @@
 				RelativePath=".\..\src\blitter\8bpp_simple.hpp">
 			</File>
 			<File
+				RelativePath=".\..\src\blitter\blitter.hpp">
+			</File>
+			<File
 				RelativePath=".\..\src\blitter\null.cpp">
 			</File>
 			<File
 				RelativePath=".\..\src\blitter\null.hpp">
 			</File>
-			<File
-				RelativePath=".\..\src\blitter\blitter.hpp">
-			</File>
 		</Filter>
 		<Filter
 			Name="Sprite loaders"
--- a/projects/openttd_vs80.vcproj	Sat Jun 16 11:13:30 2007 +0000
+++ b/projects/openttd_vs80.vcproj	Sat Jun 16 12:03:36 2007 +0000
@@ -1540,6 +1540,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\blitter\blitter.hpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\blitter\null.cpp"
 				>
 			</File>
@@ -1547,10 +1551,6 @@
 				RelativePath=".\..\src\blitter\null.hpp"
 				>
 			</File>
-			<File
-				RelativePath=".\..\src\blitter\blitter.hpp"
-				>
-			</File>
 		</Filter>
 		<Filter
 			Name="Sprite loaders"
--- a/source.list	Sat Jun 16 11:13:30 2007 +0000
+++ b/source.list	Sat Jun 16 12:03:36 2007 +0000
@@ -300,9 +300,9 @@
 blitter/8bpp_optimized.hpp
 blitter/8bpp_simple.cpp
 blitter/8bpp_simple.hpp
+blitter/blitter.hpp
 blitter/null.cpp
 blitter/null.hpp
-blitter/blitter.hpp
 
 # Sprite loaders
 spriteloader/grf.cpp
--- a/src/gfxinit.cpp	Sat Jun 16 11:13:30 2007 +0000
+++ b/src/gfxinit.cpp	Sat Jun 16 12:03:36 2007 +0000
@@ -114,33 +114,7 @@
  * returns true if the checksum is correct */
 static bool FileMD5(const MD5File file, bool warn)
 {
-	FILE *f;
-	char buf[MAX_PATH];
-
-	/* open file */
-	snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, file.filename);
-	f = fopen(buf, "rb");
-
-#if !defined(WIN32)
-	if (f == NULL) {
-		strtolower(buf + strlen(_paths.data_dir) - 1);
-		f = fopen(buf, "rb");
-	}
-#endif
-
-#if defined SECOND_DATA_DIR
-	/* If we failed to find the file in the first data directory, we will try the other one */
-
-	if (f == NULL) {
-		snprintf(buf, lengthof(buf), "%s%s", _paths.second_data_dir, file.filename);
-		f = fopen(buf, "rb");
-
-		if (f == NULL) {
-			strtolower(buf + strlen(_paths.second_data_dir) - 1);
-			f = fopen(buf, "rb");
-		}
-	}
-#endif
+	FILE *f = FioFOpenFile(file.filename);
 
 	if (f != NULL) {
 		md5_state_t filemd5state;
@@ -152,7 +126,7 @@
 		while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
 			md5_append(&filemd5state, buffer, len);
 
-		if (ferror(f) && warn) ShowInfoF("Error Reading from %s \n", buf);
+		if (ferror(f) && warn) ShowInfoF("Error Reading from %s \n", file.filename);
 		fclose(f);
 
 		md5_finish(&filemd5state, digest);