Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)

This commit is contained in:
Shauren
2023-01-08 21:16:53 +01:00
parent b6820a706f
commit d791afae1d
294 changed files with 4921 additions and 4944 deletions
+6 -6
View File
@@ -1031,7 +1031,7 @@ bool ConvertADT(uint32 fileDataId, std::string const& mapName, std::string const
{
ChunkedFile adt;
if (!adt.loadFile(CascStorage, fileDataId, Trinity::StringFormat("Map %s grid [%u,%u]", mapName.c_str(), gx, gy)))
if (!adt.loadFile(CascStorage, fileDataId, Trinity::StringFormat("Map {} grid [{},{}]", mapName, gx, gy)))
return false;
return ConvertADT(adt, mapName, outputPath, gx, gy, build, ignoreDeepWater);
@@ -1085,7 +1085,7 @@ void ExtractMaps(uint32 build)
// Loadup map grid data
ChunkedFile wdt;
std::bitset<(WDT_MAP_SIZE) * (WDT_MAP_SIZE)> existingTiles;
if (wdt.loadFile(CascStorage, map_ids[z].WdtFileDataId, Trinity::StringFormat("WDT for map %u", map_ids[z].Id), false))
if (wdt.loadFile(CascStorage, map_ids[z].WdtFileDataId, Trinity::StringFormat("WDT for map {}", map_ids[z].Id), false))
{
FileChunk* mphd = wdt.GetChunk("MPHD");
FileChunk* main = wdt.GetChunk("MAIN");
@@ -1097,7 +1097,7 @@ void ExtractMaps(uint32 build)
if (!(main->As<wdt_MAIN>()->adt_list[y][x].flag & 0x1))
continue;
outputFileName = Trinity::StringFormat("%s/maps/%04u_%02u_%02u.map", output_path.string().c_str(), map_ids[z].Id, y, x);
outputFileName = Trinity::StringFormat("{}/maps/{:04}_{:02}_{:02}.map", output_path.string(), map_ids[z].Id, y, x);
bool ignoreDeepWater = IsDeepWaterIgnored(map_ids[z].Id, y, x);
if (mphd && mphd->As<wdt_MPHD>()->flags & 0x200)
{
@@ -1105,7 +1105,7 @@ void ExtractMaps(uint32 build)
}
else
{
std::string storagePath = Trinity::StringFormat(R"(World\Maps\%s\%s_%u_%u.adt)", map_ids[z].Directory.c_str(), map_ids[z].Directory.c_str(), x, y);
std::string storagePath = Trinity::StringFormat(R"(World\Maps\{}\{}_{}_{}.adt)", map_ids[z].Directory, map_ids[z].Directory, x, y);
existingTiles[y * WDT_MAP_SIZE + x] = ConvertADT(storagePath, map_ids[z].Name, outputFileName, y, x, build, ignoreDeepWater);
}
}
@@ -1116,7 +1116,7 @@ void ExtractMaps(uint32 build)
}
}
if (FILE* tileList = fopen(Trinity::StringFormat("%s/maps/%04u.tilelist", output_path.string().c_str(), map_ids[z].Id).c_str(), "wb"))
if (FILE* tileList = fopen(Trinity::StringFormat("{}/maps/{:04}.tilelist", output_path.string(), map_ids[z].Id).c_str(), "wb"))
{
fwrite(MapMagic.data(), 1, MapMagic.size(), tileList);
fwrite(&MapVersionMagic, 1, sizeof(MapVersionMagic), tileList);
@@ -1307,7 +1307,7 @@ void ExtractCameraFiles()
std::unique_ptr<CASC::File> cameraFile(CascStorage->OpenFile(cameraFileDataId, CASC_LOCALE_NONE));
if (cameraFile)
{
boost::filesystem::path filePath = outputPath / Trinity::StringFormat("FILE%08X.xxx", cameraFileDataId);
boost::filesystem::path filePath = outputPath / Trinity::StringFormat("FILE{:08X}.xxx", cameraFileDataId);
if (!boost::filesystem::exists(filePath))
if (ExtractFile(cameraFile.get(), filePath.string()))