feat(validate): report file counts and per-format invalid totals

The previous --validate output told you whether *some* file of each
type existed, which was hard to act on for partially-valid zones.
Now reports the per-format file count and how many failed magic
validation, e.g. 'WOM (12 invalid: 2)' so a zone author can spot
missing or corrupted models without grepping through file listings.
This commit is contained in:
Kelsi 2026-05-06 07:12:04 -07:00
parent 7e2dc4ec1d
commit 5af4bba556
3 changed files with 35 additions and 19 deletions

View file

@ -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;