From 396138fbfd7f7aa742b4bbbdf0497f51534881de Mon Sep 17 00:00:00 2001 From: drcarademono <73616371+drcarademono@users.noreply.github.com> Date: Fri, 29 Nov 2024 12:35:17 -0800 Subject: [PATCH] Correct Akatosh Chantry bug --- Assets/Scripts/Game/Formulas/FormulaHelper.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Game/Formulas/FormulaHelper.cs b/Assets/Scripts/Game/Formulas/FormulaHelper.cs index 8e0fbf86a6..312ec2e730 100644 --- a/Assets/Scripts/Game/Formulas/FormulaHelper.cs +++ b/Assets/Scripts/Game/Formulas/FormulaHelper.cs @@ -3025,9 +3025,23 @@ public static string GenerateBuildingName(int seed, DFLocation.BuildingTypes typ break; case DFLocation.BuildingTypes.Temple: - // Temples get name from faction data - always seem to be first child of factionID + // Temples get name from faction data - always seem to be first child of the top-level factionID if (GameManager.Instance.PlayerEntity.FactionData.GetFactionData(factionID, out factionData)) { + // Traverse up to find the top-level faction + while (factionData.parent != 0) + { + if (GameManager.Instance.PlayerEntity.FactionData.GetFactionData(factionData.parent, out FactionFile.FactionData parentFaction)) + { + factionData = parentFaction; + } + else + { + break; // If we can't find the parent, stop the loop + } + } + + // Now that we have the top-level faction, get its first child if (factionData.children.Count > 0) { FactionFile.FactionData firstChild;