Merge branch 'master' into jgrpp

# Conflicts:
#	src/base_media_func.h
#	src/cargopacket.h
#	src/gfxinit.cpp
#	src/industry_cmd.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-05-26 20:08:05 +01:00
90 changed files with 382 additions and 358 deletions

View File

@@ -48,16 +48,16 @@ static const SpriteID * const _landscape_spriteindexes[] = {
* @param load_index The offset of the first sprite.
* @param needs_palette_remap Whether the colours in the GRF file need a palette remap.
*/
static SpriteFile &LoadGrfFile(const char *filename, uint load_index, bool needs_palette_remap)
static SpriteFile &LoadGrfFile(const std::string &filename, uint load_index, bool needs_palette_remap)
{
uint sprite_id = 0;
SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
DEBUG(sprite, 2, "Reading grf-file '%s'", filename);
DEBUG(sprite, 2, "Reading grf-file '%s'", filename.c_str());
byte container_ver = file.GetContainerVersion();
if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename);
if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename.c_str());
ReadGRFSpriteOffsets(file);
if (container_ver >= 2) {
/* Read compression. */
@@ -84,17 +84,17 @@ static SpriteFile &LoadGrfFile(const char *filename, uint load_index, bool needs
* @param needs_palette_remap Whether the colours in the GRF file need a palette remap.
* @return The number of loaded sprites.
*/
static void LoadGrfFileIndexed(const char *filename, const SpriteID *index_tbl, bool needs_palette_remap)
static void LoadGrfFileIndexed(const std::string &filename, const SpriteID *index_tbl, bool needs_palette_remap)
{
uint start;
uint sprite_id = 0;
SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename);
DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename.c_str());
byte container_ver = file.GetContainerVersion();
if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename);
if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename.c_str());
ReadGRFSpriteOffsets(file);
if (container_ver >= 2) {
/* Read compression. */
@@ -142,7 +142,7 @@ void CheckExternalFiles()
add_pos += seprintf(add_pos, last, "Trying to load graphics set '%s', but it is incomplete. The game will probably not run correctly until you properly install this set or select another one. See section 4.1 of README.md.\n\nThe following files are corrupted or missing:\n", used_set->name.c_str());
for (uint i = 0; i < GraphicsSet::NUM_FILES; i++) {
MD5File::ChecksumResult res = GraphicsSet::CheckMD5(&used_set->files[i], BASESET_DIR);
if (res != MD5File::CR_MATCH) add_pos += seprintf(add_pos, last, "\t%s is %s (%s)\n", used_set->files[i].filename, res == MD5File::CR_MISMATCH ? "corrupt" : "missing", used_set->files[i].missing_warning);
if (res != MD5File::CR_MATCH) add_pos += seprintf(add_pos, last, "\t%s is %s (%s)\n", used_set->files[i].filename.c_str(), res == MD5File::CR_MISMATCH ? "corrupt" : "missing", used_set->files[i].missing_warning.c_str());
}
add_pos += seprintf(add_pos, last, "\n");
}
@@ -154,7 +154,7 @@ void CheckExternalFiles()
static_assert(SoundsSet::NUM_FILES == 1);
/* No need to loop each file, as long as there is only a single
* sound file. */
add_pos += seprintf(add_pos, last, "\t%s is %s (%s)\n", sounds_set->files->filename, SoundsSet::CheckMD5(sounds_set->files, BASESET_DIR) == MD5File::CR_MISMATCH ? "corrupt" : "missing", sounds_set->files->missing_warning);
add_pos += seprintf(add_pos, last, "\t%s is %s (%s)\n", sounds_set->files->filename.c_str(), SoundsSet::CheckMD5(sounds_set->files, BASESET_DIR) == MD5File::CR_MISMATCH ? "corrupt" : "missing", sounds_set->files->missing_warning.c_str());
}
if (add_pos != error_msg) ShowInfoF("%s", error_msg);
@@ -257,7 +257,7 @@ static void LoadSpriteTables()
ClrBit(master->flags, GCF_INIT_ONLY);
/* Baseset extra graphics */
GRFConfig *extra = new GRFConfig(used_set->files[GFT_EXTRA].filename);
GRFConfig *extra = new GRFConfig(used_set->files[GFT_EXTRA].filename.c_str());
/* We know the palette of the base set, so if the base NewGRF is not
* setting one, use the palette of the base set and not the global
@@ -542,7 +542,7 @@ void GfxLoadSprites()
DEBUG(sprite, 2, "Completed loading sprite set %d", _settings_game.game_creation.landscape);
}
bool GraphicsSet::FillSetDetails(IniFile *ini, const char *path, const char *full_filename)
bool GraphicsSet::FillSetDetails(IniFile *ini, const std::string &path, const std::string &full_filename)
{
bool ret = this->BaseSet<GraphicsSet, MAX_GFT, true>::FillSetDetails(ini, path, full_filename, false);
if (ret) {