From c9522fb740200ccef6230cec452c48efb31e5394 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 11 May 2023 22:05:17 +0200 Subject: Removed all Printf-family functions from StringUtils. Replaced them with fmt::format calls, including changes to the format strings. Also changed the format strings to use FMT_STRING, so that the format is checked compile-time against the arguments. Also fixed code-style violations already present in the code. --- Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Tools/GrownBiomeGenVisualiser') diff --git a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp index 31418b008..5201c28bf 100644 --- a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp +++ b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp @@ -38,7 +38,6 @@ void generateExamples(int a_Seed); - /** Color palette used for algorithm examples. No relevance to biomes whatsoever. */ static const Color spectrumColors[] = @@ -82,8 +81,7 @@ static const struct { EMCSBiome biome; Color color; -} -biomeColorMap[] = +} biomeColorMap[] = { { biOcean, { 0x00, 0x00, 0x70 }, }, { biPlains, { 0x8d, 0xb3, 0x60 }, }, @@ -271,7 +269,7 @@ void generateZoomLevels(int a_Seed) gen->GetInts(0, 0, arrSize, arrSize, workspace); // Output to a bitmap file: - AString fnam = Printf("zoomedgrown_%u.pbm", i); + AString fnam = fmt::format(FMT_STRING("zoomedgrown_{}.pbm"), i); outputBitmapFile(fnam, 257, 257, workspace, arrSize, arrSize, spectrumColors, ARRAYCOUNT(spectrumColors)); log(" zoom level %u complete", i); } // for i - Image @@ -309,7 +307,7 @@ void generateSmoothLevels(int a_Seed) gen->GetInts(static_cast(i), static_cast(i), arrSize, arrSize, workspace); // Output to a bitmap file: - AString fnam = Printf("smoothedgrown_%u.ppm", i); + AString fnam = fmt::format(FMT_STRING("smoothedgrown_{}.ppm"), i); outputBitmapFile(fnam, 257, 257, workspace, arrSize, arrSize, spectrumColors, ARRAYCOUNT(spectrumColors)); log(" smooth level %u complete", i); } // for i - Image @@ -404,7 +402,7 @@ void generateExamples(int a_Seed) for (const auto & gen: gens) { gen.gen->GetInts(gen.offset, gen.offset, gen.size, gen.size, workspace); - AString fnam = Printf("grownexample_%s.ppm", gen.name); + AString fnam = fmt::format(FMT_STRING("grownexample_{}.ppm"), gen.name); outputBitmapFile(fnam, 256, 256, workspace, gen.size, gen.size, gen.colormap.colors, gen.colormap.count); log(" Created example \"%s\"", gen.name); } // for gen - gens[] -- cgit v1.2.3