From 02895948051e75dbfaa41ed2b05e2d5cb9af33de Mon Sep 17 00:00:00 2001 From: Martin Benjamins Date: Sun, 24 Nov 2024 06:02:04 +0100 Subject: [PATCH] Fix WDB6 in test uril --- code/C#/DBDefsTest/Program.cs | 20 ++++++++++++++++---- code/C#/DBDefsTest/Structs/DBC.cs | 1 - 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/code/C#/DBDefsTest/Program.cs b/code/C#/DBDefsTest/Program.cs index dad27db02f0..0e855f341c4 100644 --- a/code/C#/DBDefsTest/Program.cs +++ b/code/C#/DBDefsTest/Program.cs @@ -56,7 +56,7 @@ static void Main(string[] args) foreach(var build in builds) { - if (build.expansion != 8 || build.major != 1) continue; + if (build.expansion != 7 || build.major < 1) continue; Console.WriteLine("Checking " + build + ".."); if (Directory.Exists(Path.Combine(dbcDir, build.ToString(), "DBFilesClient"))) @@ -87,6 +87,13 @@ static void LoadDBC(string filename) if (!definitionCache.ContainsKey(name.ToLower())) { + Console.WriteLine("No definition found for " + name + ", skipping."); + return; + } + + if(Path.GetExtension(filename) != ".dbc" && Path.GetExtension(filename) != ".db2") + { + Console.WriteLine("Skipping " + filename + " as it is not a DBC file, skipping."); return; } @@ -166,7 +173,7 @@ static void LoadDBC(string filename) case "WDB6": var db6header = bin.Read(); fileDef.recordSize = db6header.recordSize; - fileDef.fieldCount = db6header.fieldCount; + fileDef.fieldCount = db6header.totalFieldCount; fileDef.layoutHash = db6header.layoutHash.ToString("X8"); break; case "WDC1": @@ -311,6 +318,11 @@ static void LoadDBC(string filename) Console.ResetColor(); } + if(fileDef.fields == null) + { + return; + } + // Check record sizes var dbdRecordSize = 0; var i = 0; @@ -389,7 +401,7 @@ static void LoadDBC(string filename) if (!layoutHashFound && fileDef.layoutHash != "") { foundError = true; - Console.ForegroundColor = ConsoleColor.Red; + Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[" + buildDir + "][" + Path.GetFileNameWithoutExtension(filename) + "] Unable to find layouthash in definitions!"); Console.ResetColor(); } @@ -397,7 +409,7 @@ static void LoadDBC(string filename) if (!dbChecked) { foundError = true; - Console.ForegroundColor = ConsoleColor.Red; + Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[" + buildDir + "][" + Path.GetFileNameWithoutExtension(filename) + "] Unable to find applicable definitions!"); Console.ResetColor(); } diff --git a/code/C#/DBDefsTest/Structs/DBC.cs b/code/C#/DBDefsTest/Structs/DBC.cs index 4f8a58790a8..6fe2afe1fff 100644 --- a/code/C#/DBDefsTest/Structs/DBC.cs +++ b/code/C#/DBDefsTest/Structs/DBC.cs @@ -81,7 +81,6 @@ public struct WDB6Header public uint stringTableSize; public uint tableHash; public uint layoutHash; - public uint timestampLastWritten; public uint minID; public uint maxID; public uint locale;