Skip to content

Commit f4a96c1

Browse files
authored
Add some debug logging to the code that outputs CCU effects (#2621) #patch
1 parent bf470cc commit f4a96c1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ImperatorToCK3/Outputter/CulturesOutputter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ private static void OutputCCUParameters(string outputModPath, ModFilesystem ck3M
9797
Logger.Warn("Could not find ccu_scripted_effects.txt in the CK3 mod. Aborting the outputting of CCU parameters.");
9898
return;
9999
}
100-
100+
Logger.Debug($"Found ccu_scripted_effects.txt at {scriptedEffectsPath}");
101+
101102
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
102103

103104
string fileText = File.ReadAllText(scriptedEffectsPath, Encoding.UTF8);
@@ -400,13 +401,13 @@ private static void AddChildrenToNode(Node node, string filePath, string fileNam
400401
private static void AddChildrenToNodeAfterLastChildContainingText(Node node, string filePath, string fileName, string[] childrenStrings, string precedingChildText) {
401402
List<Child> allChildren = node.AllChildren;
402403

403-
Child? predecingChild = allChildren.LastOrNull(c => CKPrinter.api.prettyPrintStatement.Invoke(c.node.ToRaw).Contains(precedingChildText));
404-
if (predecingChild is null) {
404+
Child? precedingChild = allChildren.LastOrNull(c => CKPrinter.api.prettyPrintStatement.Invoke(c.node.ToRaw).Contains(precedingChildText));
405+
if (!precedingChild.HasValue) {
405406
Logger.Warn($"Failed to find the preceding child containing the text '{precedingChildText}'!");
406407
return;
407408
}
408409

409-
int indexToUse = allChildren.IndexOf(predecingChild.Value) + 1;
410+
int indexToUse = allChildren.IndexOf(precedingChild.Value) + 1;
410411

411412
foreach (var childStr in childrenStrings) {
412413
var statements = CKParser.parseString(childStr, fileName).GetResult();
@@ -428,6 +429,7 @@ private static void OutputCCUErrorSuppression(string outputModPath, ModFilesyste
428429
"Some harmless errors related to converter-added language parameters may appear in error.log.");
429430
return;
430431
}
432+
Logger.Debug($"Found ccu_error_suppression.txt at {errorSuppressionPath}");
431433

432434
// In the file, find the last line that contains: "if = { limit = { var:temp = flag:heritage_family_",
433435
// and output the same line for each heritage family parameter.

0 commit comments

Comments
 (0)