Index: ps/trunk/binaries/data/mods/public/globalscripts/Templates.js =================================================================== --- ps/trunk/binaries/data/mods/public/globalscripts/Templates.js +++ ps/trunk/binaries/data/mods/public/globalscripts/Templates.js @@ -367,7 +367,7 @@ ret.cost = { "time": template.researchTime ? +template.researchTime : 0 }; for (let type of resources.GetCodes()) - ret.cost[type] = template.cost ? +template.cost[type] : 0; + ret.cost[type] = +(template.cost && template.cost[type] || 0); ret.tooltip = template.tooltip; ret.requirementsTooltip = template.requirementsTooltip || ""; Index: ps/trunk/binaries/data/mods/public/gui/structree/draw.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/structree/draw.js +++ ps/trunk/binaries/data/mods/public/gui/structree/draw.js @@ -183,7 +183,7 @@ prod = g_ParsedData.units[prod]; break; case "techs": - prod = clone(g_ParsedData.techs[civCode][prod]); + prod = clone(g_ParsedData.techs[g_SelectedCiv][prod]); for (let res in trainer.techCostMultiplier) if (prod.cost[res]) prod.cost[res] *= trainer.techCostMultiplier[res]; Index: ps/trunk/binaries/data/mods/public/gui/structree/helper.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/structree/helper.js +++ ps/trunk/binaries/data/mods/public/gui/structree/helper.js @@ -72,7 +72,7 @@ { let phaseIdx = -1; - if (basename(techName).slice(0, 5) === "phase") + if (basename(techName).startsWith("phase")) { phaseIdx = g_ParsedData.phaseList.indexOf(GetActualPhase(techName)); if (phaseIdx > 0) @@ -80,7 +80,13 @@ } if (!g_ParsedData.techs[g_SelectedCiv][techName]) - warn(g_SelectedCiv + " : " + techName); + { + let techData = loadTechnology(techName); + g_ParsedData.techs[g_SelectedCiv][techName] = techData; + warn("The \"" + techData.name.generic + "\" technology is not researchable in any structure buildable by the " + + g_SelectedCiv + " civilisation, but is required by something that this civ can research, train or build!"); + } + let techReqs = g_ParsedData.techs[g_SelectedCiv][techName].reqs; if (!techReqs) return false; @@ -89,8 +95,10 @@ if (option.techs) for (let tech of option.techs) { - if (basename(tech).slice(0, 5) === "phase") + if (basename(tech).startsWith("phase")) return tech; + if (basename(tech).startsWith("pair")) + continue; phaseIdx = Math.max(phaseIdx, g_ParsedData.phaseList.indexOf(GetPhaseOfTechnology(tech))); } return g_ParsedData.phaseList[phaseIdx] || false; Index: ps/trunk/binaries/data/mods/public/gui/structree/structree.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/structree/structree.js +++ ps/trunk/binaries/data/mods/public/gui/structree/structree.js @@ -245,8 +245,19 @@ buildList[phase].push(structCode); } for (let unitCode of g_Lists.units) - if (g_ParsedData.units[unitCode] && g_ParsedData.units[unitCode].production) + if (g_ParsedData.units[unitCode] && g_ParsedData.units[unitCode].production && Object.keys(g_ParsedData.units[unitCode].production).length) + { + // Replace any pair techs with the actual techs of that pair + if (g_ParsedData.units[unitCode].production.techs) + for (let prod of g_ParsedData.units[unitCode].production.techs) + if (prod in techPairs) + g_ParsedData.units[unitCode].production.techs.splice( + g_ParsedData.units[unitCode].production.techs.indexOf(prod), + 1, ...techPairs[prod].techs + ); + trainerList.push(unitCode); + } g_CivData[g_SelectedCiv].buildList = buildList; g_CivData[g_SelectedCiv].trainList = trainerList;