Codechange: make Subdirectory a scoped enum

This commit is contained in:
Peter Nelson
2026-04-05 19:02:51 +01:00
committed by Peter Nelson
parent 93a6aa77c6
commit 5aae8e2d64
52 changed files with 218 additions and 216 deletions
+6 -6
View File
@@ -47,7 +47,7 @@ static uint LoadGrfFile(const std::string &filename, SpriteID load_index, bool n
SpriteID load_index_org = load_index;
SpriteID sprite_id = 0;
SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
SpriteFile &file = OpenCachedSpriteFile(filename, Subdirectory::Baseset, needs_palette_remap);
Debug(sprite, 2, "Reading grf-file '{}'", filename);
@@ -82,7 +82,7 @@ static void LoadGrfFileIndexed(const std::string &filename, std::span<const std:
{
uint sprite_id = 0;
SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
SpriteFile &file = OpenCachedSpriteFile(filename, Subdirectory::Baseset, needs_palette_remap);
Debug(sprite, 2, "Reading indexed grf-file '{}'", filename);
@@ -123,7 +123,7 @@ void CheckExternalFiles()
/* Not all files were loaded successfully, see which ones */
fmt::format_to(output_iterator, "Trying to load graphics set '{}', but it is incomplete. The game will probably not run correctly until you properly install this set or select another one. See section 1.4 of README.md.\n\nThe following files are corrupted or missing:\n", used_set->name);
for (const auto &file : used_set->files) {
MD5File::ChecksumResult res = GraphicsSet::CheckMD5(&file, BASESET_DIR);
MD5File::ChecksumResult res = GraphicsSet::CheckMD5(&file, Subdirectory::Baseset);
if (res != MD5File::CR_MATCH) fmt::format_to(output_iterator, "\t{} is {} ({})\n", file.filename, res == MD5File::CR_MISMATCH ? "corrupt" : "missing", file.missing_warning);
}
fmt::format_to(output_iterator, "\n");
@@ -136,7 +136,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. */
fmt::format_to(output_iterator, "\t{} is {} ({})\n", sounds_set->files[0].filename, SoundsSet::CheckMD5(&sounds_set->files[0], BASESET_DIR) == MD5File::CR_MISMATCH ? "corrupt" : "missing", sounds_set->files[0].missing_warning);
fmt::format_to(output_iterator, "\t{} is {} ({})\n", sounds_set->files[0].filename, SoundsSet::CheckMD5(&sounds_set->files[0], Subdirectory::Baseset) == MD5File::CR_MISMATCH ? "corrupt" : "missing", sounds_set->files[0].missing_warning);
}
if (!error_msg.empty()) ShowInfoI(error_msg);
@@ -150,7 +150,7 @@ static std::unique_ptr<GRFConfig> GetDefaultExtraGRFConfig()
{
auto gc = std::make_unique<GRFConfig>("OPENTTD.GRF");
gc->palette |= GRFP_GRF_DOS;
FillGRFDetails(*gc, false, BASESET_DIR);
FillGRFDetails(*gc, false, Subdirectory::Baseset);
gc->flags.Reset(GRFConfigFlag::InitOnly);
return gc;
}
@@ -388,7 +388,7 @@ GRFConfig &GraphicsSet::GetOrCreateExtraConfig() const
case PAL_WINDOWS: this->extra_cfg->palette |= GRFP_GRF_WINDOWS; break;
default: break;
}
FillGRFDetails(*this->extra_cfg, false, BASESET_DIR);
FillGRFDetails(*this->extra_cfg, false, Subdirectory::Baseset);
}
return *this->extra_cfg;
}