diff --git a/tools/editor/content_pack.cpp b/tools/editor/content_pack.cpp index 2ad1b5b7..58dcd3f0 100644 --- a/tools/editor/content_pack.cpp +++ b/tools/editor/content_pack.cpp @@ -277,25 +277,28 @@ ContentPacker::ValidationResult ContentPacker::validateZone(const std::string& z if (!entry.is_regular_file()) continue; std::string ext = entry.path().extension().string(); std::string fname = entry.path().filename().string(); - if (ext == ".wot") r.hasWot = true; + if (ext == ".wot") { r.hasWot = true; r.wotCount++; } if (ext == ".whm") { - r.hasWhm = true; + r.hasWhm = true; r.whmCount++; if (checkMagic(entry.path().string(), WHM_MAGIC)) r.whmValid = true; } if (ext == ".wom") { - r.hasWom = true; + r.hasWom = true; r.womCount++; if (checkAnyMagic(entry.path().string(), {WOM_MAGIC, WOM2_MAGIC, WOM3_MAGIC})) r.womValid = true; + else r.womInvalidCount++; } if (ext == ".wob") { - r.hasWob = true; + r.hasWob = true; r.wobCount++; if (checkMagic(entry.path().string(), WOB_MAGIC)) r.wobValid = true; + else r.wobInvalidCount++; } if (ext == ".woc") { - r.hasWoc = true; + r.hasWoc = true; r.wocCount++; if (checkMagic(entry.path().string(), WOC_MAGIC)) r.wocValid = true; + else r.wocInvalidCount++; } - if (ext == ".png") r.hasPng = true; + if (ext == ".png") { r.hasPng = true; r.pngCount++; } if (fname == "zone.json") r.hasZoneJson = true; if (fname == "creatures.json") r.hasCreatures = true; if (fname == "quests.json") r.hasQuests = true; diff --git a/tools/editor/content_pack.hpp b/tools/editor/content_pack.hpp index d44b35d1..b0a8136a 100644 --- a/tools/editor/content_pack.hpp +++ b/tools/editor/content_pack.hpp @@ -41,6 +41,14 @@ public: bool hasPng = false, hasWom = false, hasWob = false, hasWoc = false; bool hasCreatures = false, hasQuests = false, hasObjects = false; bool whmValid = false, womValid = false, wobValid = false, wocValid = false; + // Counts of each format file (the has* booleans only tell whether + // at least one exists; counts are useful for the --validate report). + int wotCount = 0, whmCount = 0, womCount = 0, wobCount = 0; + int wocCount = 0, pngCount = 0; + // Counts of files that failed magic validation. A non-zero count + // means the zone has at least one corrupted file; a player would + // see missing geometry on load. + int womInvalidCount = 0, wobInvalidCount = 0, wocInvalidCount = 0; int openFormatScore() const; std::string summary() const; }; diff --git a/tools/editor/main.cpp b/tools/editor/main.cpp index aa539505..d15234c1 100644 --- a/tools/editor/main.cpp +++ b/tools/editor/main.cpp @@ -192,20 +192,25 @@ int main(int argc, char* argv[]) { std::printf("Open format score: %d/7\n", score); std::printf("Formats: %s\n", v.summary().c_str()); std::printf("Files present:\n"); - std::printf(" WOT (terrain meta) : %s\n", v.hasWot ? "yes" : "no"); - std::printf(" WHM (heightmap) : %s%s\n", - v.hasWhm ? "yes" : "no", + std::printf(" WOT (terrain meta) : %s (%d)\n", + v.hasWot ? "yes" : "no", v.wotCount); + std::printf(" WHM (heightmap) : %s (%d)%s\n", + v.hasWhm ? "yes" : "no", v.whmCount, v.hasWhm && !v.whmValid ? " (BAD MAGIC)" : ""); - std::printf(" WOM (models) : %s%s\n", - v.hasWom ? "yes" : "no", - v.hasWom && !v.womValid ? " (BAD MAGIC)" : ""); - std::printf(" WOB (buildings) : %s%s\n", - v.hasWob ? "yes" : "no", - v.hasWob && !v.wobValid ? " (BAD MAGIC)" : ""); - std::printf(" WOC (collision) : %s%s\n", - v.hasWoc ? "yes" : "no", - v.hasWoc && !v.wocValid ? " (BAD MAGIC)" : ""); - std::printf(" PNG (textures) : %s\n", v.hasPng ? "yes" : "no"); + std::printf(" WOM (models) : %s (%d)%s\n", + v.hasWom ? "yes" : "no", v.womCount, + v.womInvalidCount > 0 ? + (" (" + std::to_string(v.womInvalidCount) + " invalid)").c_str() : ""); + std::printf(" WOB (buildings) : %s (%d)%s\n", + v.hasWob ? "yes" : "no", v.wobCount, + v.wobInvalidCount > 0 ? + (" (" + std::to_string(v.wobInvalidCount) + " invalid)").c_str() : ""); + std::printf(" WOC (collision) : %s (%d)%s\n", + v.hasWoc ? "yes" : "no", v.wocCount, + v.wocInvalidCount > 0 ? + (" (" + std::to_string(v.wocInvalidCount) + " invalid)").c_str() : ""); + std::printf(" PNG (textures) : %s (%d)\n", + v.hasPng ? "yes" : "no", v.pngCount); std::printf(" zone.json : %s\n", v.hasZoneJson ? "yes" : "no"); std::printf(" creatures.json : %s\n", v.hasCreatures ? "yes" : "no"); std::printf(" quests.json : %s\n", v.hasQuests ? "yes" : "no");