From f271dd2bc1260fcc7540d5d7db75877e3266420d Mon Sep 17 00:00:00 2001 From: mimo Date: Sat, 12 Sep 2015 20:02:14 +0000 Subject: [PATCH] fix display in structure tree of techs researchable only at a later phase than their availability, #fix #3411, patch by S0600204 This was SVN commit r17008. --- .../mods/public/gui/structree/structree.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/binaries/data/mods/public/gui/structree/structree.js b/binaries/data/mods/public/gui/structree/structree.js index 3e0d98954a..83bcf00470 100644 --- a/binaries/data/mods/public/gui/structree/structree.js +++ b/binaries/data/mods/public/gui/structree/structree.js @@ -131,6 +131,7 @@ function selectCiv(civCode) for (let structCode of g_Lists.structures) { let structInfo = g_ParsedData.structures[structCode]; + let structPhaseIdx = g_ParsedData.phaseList.indexOf(structInfo.phase); // If this building is shared with another civ, // it may have already gone through the grouping process already @@ -170,11 +171,11 @@ function selectCiv(civCode) phase = req; } - if (depath(phase).slice(0,5) !== "phase") - { - warn(prod+" doesn't have a specific phase set ("+structCode+")"); - phase = structInfo.phase; - } + if (depath(phase).slice(0,5) !== "phase" || g_ParsedData.phaseList.indexOf(phase) < structPhaseIdx) + if (structInfo.phase !== false) + phase = structInfo.phase; + else + phase = g_ParsedData.phaseList[0]; if (!(phase in newProdTech)) newProdTech[phase] = []; @@ -202,10 +203,12 @@ function selectCiv(civCode) else phase = reqs.generic[0]; } - else if (structInfo.phase !== false) - phase = structInfo.phase; - else - phase = g_ParsedData.phaseList[0]; + + if (depath(phase).slice(0,5) !== "phase" || g_ParsedData.phaseList.indexOf(phase) < structPhaseIdx) + if (structInfo.phase !== false) + phase = structInfo.phase; + else + phase = g_ParsedData.phaseList[0]; if (!(phase in newProdUnits)) newProdUnits[phase] = [];