Fix phase names not updating on the structure tree

Reload all cached phase data when switching civ.
Add missing query for the generic phase technologies to the phase idents.
This commit is contained in:
Vantha
2024-12-25 10:47:38 +01:00
committed by Nicolas Auvray
parent 314bc4185b
commit 33111dc816
2 changed files with 7 additions and 1 deletions
@@ -371,6 +371,9 @@ class TemplateParser
derivePhaseList(technologyList, civCode)
{
// Wipe all cached phase data. It contains the previous civ's SpecificNames which wouldn't be reloaded otherwise.
this.phases = {};
// Load all of a civ's specific phase technologies
for (let techcode of technologyList)
if (this.TemplateLoader.isPhaseTech(techcode))
@@ -47,7 +47,10 @@ class PhaseIdent
drawPhaseIcon(phaseIcon, phaseIndex, civCode)
{
let phaseName = this.page.TemplateParser.phaseList[phaseIndex];
let prodPhaseTemplate = this.page.TemplateParser.getTechnology(phaseName + "_" + civCode, civCode) || this.page.TemplateParser.getTechnology(phaseName, civCode);
let prodPhaseTemplate =
this.page.TemplateParser.getTechnology(phaseName + "_" + civCode, civCode) ||
this.page.TemplateParser.getTechnology(phaseName + "_generic", civCode) ||
this.page.TemplateParser.getTechnology(phaseName, civCode);
phaseIcon.sprite = "stretched:" + this.page.IconPath + prodPhaseTemplate.icon;
phaseIcon.tooltip = getEntityNamesFormatted(prodPhaseTemplate);