Merge branch 'master' into jgrpp

# Conflicts:
#	CMakeLists.txt
#	src/3rdparty/md5/md5.h
#	src/3rdparty/squirrel/squirrel/squtils.h
#	src/animated_tile.cpp
#	src/console_func.h
#	src/core/CMakeLists.txt
#	src/core/container_func.hpp
#	src/core/smallstack_type.hpp
#	src/crashlog.cpp
#	src/crashlog.h
#	src/debug.h
#	src/economy.cpp
#	src/gamelog.cpp
#	src/industry_gui.cpp
#	src/lang/catalan.txt
#	src/misc_gui.cpp
#	src/network/network_content.h
#	src/newgrf.cpp
#	src/newgrf.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/newgrf_gui.cpp
#	src/os/unix/font_unix.cpp
#	src/os/windows/crashlog_win.cpp
#	src/rail_cmd.cpp
#	src/saveload/animated_tile_sl.cpp
#	src/script/api/script_tilelist.cpp
#	src/settings.cpp
#	src/settingsgen/settingsgen.cpp
#	src/sl/oldloader_sl.cpp
#	src/station.cpp
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/strgen/strgen.cpp
#	src/strgen/strgen_base.cpp
#	src/table/settings/gui_settings.ini
#	src/train_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehicle_cmd.cpp
#	src/vehicle_gui_base.h
#	src/viewport_sprite_sorter.h
This commit is contained in:
Jonathan G Rennison
2023-07-02 12:02:36 +01:00
133 changed files with 11298 additions and 7389 deletions

View File

@@ -155,18 +155,14 @@ std::string ScriptScanner::GetConsoleList(bool newest_only) const
/** Helper for creating a MD5sum of all files within of a script. */
struct ScriptFileChecksumCreator : FileScanner {
byte md5sum[16]; ///< The final md5sum.
MD5Hash md5sum; ///< The final md5sum.
Subdirectory dir; ///< The directory to look in.
/**
* Initialise the md5sum to be all zeroes,
* so we can easily xor the data.
*/
ScriptFileChecksumCreator(Subdirectory dir)
{
this->dir = dir;
memset(this->md5sum, 0, sizeof(this->md5sum));
}
ScriptFileChecksumCreator(Subdirectory dir) : dir(dir) {}
/* Add the file and calculate the md5 sum. */
virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
@@ -174,7 +170,6 @@ struct ScriptFileChecksumCreator : FileScanner {
Md5 checksum;
uint8 buffer[1024];
size_t len, size;
byte tmp_md5sum[16];
/* Open the file ... */
FILE *f = FioFOpenFile(filename.c_str(), "rb", this->dir, &size);
@@ -185,12 +180,14 @@ struct ScriptFileChecksumCreator : FileScanner {
size -= len;
checksum.Append(buffer, len);
}
MD5Hash tmp_md5sum;
checksum.Finish(tmp_md5sum);
FioFCloseFile(f);
/* ... and xor it to the overall md5sum. */
for (uint i = 0; i < sizeof(md5sum); i++) this->md5sum[i] ^= tmp_md5sum[i];
this->md5sum ^= tmp_md5sum;
return true;
}
@@ -238,7 +235,7 @@ static bool IsSameScript(const ContentInfo *ci, bool md5sum, ScriptInfo *info, S
checksum.Scan(".nut", path);
}
return memcmp(ci->md5sum, checksum.md5sum, sizeof(ci->md5sum)) == 0;
return ci->md5sum == checksum.md5sum;
}
bool ScriptScanner::HasScript(const ContentInfo *ci, bool md5sum)