mirror of https://github.com/OpenTTD/OpenTTD
(svn r10170) -Codechange: remove some duplication of code.
parent
f4c0bfc3a4
commit
9f01009b39
|
@ -988,15 +988,15 @@
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\blitter\8bpp_simple.hpp">
|
RelativePath=".\..\src\blitter\8bpp_simple.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\..\src\blitter\blitter.hpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\blitter\null.cpp">
|
RelativePath=".\..\src\blitter\null.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\blitter\null.hpp">
|
RelativePath=".\..\src\blitter\null.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\..\src\blitter\blitter.hpp">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Sprite loaders"
|
Name="Sprite loaders"
|
||||||
|
|
|
@ -1539,6 +1539,10 @@
|
||||||
RelativePath=".\..\src\blitter\8bpp_simple.hpp"
|
RelativePath=".\..\src\blitter\8bpp_simple.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\..\src\blitter\blitter.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\blitter\null.cpp"
|
RelativePath=".\..\src\blitter\null.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1547,10 +1551,6 @@
|
||||||
RelativePath=".\..\src\blitter\null.hpp"
|
RelativePath=".\..\src\blitter\null.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\..\src\blitter\blitter.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Sprite loaders"
|
Name="Sprite loaders"
|
||||||
|
|
|
@ -300,9 +300,9 @@ blitter/8bpp_optimized.cpp
|
||||||
blitter/8bpp_optimized.hpp
|
blitter/8bpp_optimized.hpp
|
||||||
blitter/8bpp_simple.cpp
|
blitter/8bpp_simple.cpp
|
||||||
blitter/8bpp_simple.hpp
|
blitter/8bpp_simple.hpp
|
||||||
|
blitter/blitter.hpp
|
||||||
blitter/null.cpp
|
blitter/null.cpp
|
||||||
blitter/null.hpp
|
blitter/null.hpp
|
||||||
blitter/blitter.hpp
|
|
||||||
|
|
||||||
# Sprite loaders
|
# Sprite loaders
|
||||||
spriteloader/grf.cpp
|
spriteloader/grf.cpp
|
||||||
|
|
|
@ -114,33 +114,7 @@ static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn)
|
||||||
* returns true if the checksum is correct */
|
* returns true if the checksum is correct */
|
||||||
static bool FileMD5(const MD5File file, bool warn)
|
static bool FileMD5(const MD5File file, bool warn)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f = FioFOpenFile(file.filename);
|
||||||
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
|
|
||||||
|
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
md5_state_t filemd5state;
|
md5_state_t filemd5state;
|
||||||
|
@ -152,7 +126,7 @@ static bool FileMD5(const MD5File file, bool warn)
|
||||||
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
|
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
|
||||||
md5_append(&filemd5state, buffer, len);
|
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);
|
fclose(f);
|
||||||
|
|
||||||
md5_finish(&filemd5state, digest);
|
md5_finish(&filemd5state, digest);
|
||||||
|
|
Loading…
Reference in New Issue