diff --git a/binaries/data/mods/public/globalscripts/Templates.js b/binaries/data/mods/public/globalscripts/Templates.js
index db54ca469..5f01d698e 100644
a
|
b
|
function GetTechnologyDataHelper(template, civ, resources)
|
367 | 367 | |
368 | 368 | ret.cost = { "time": template.researchTime ? +template.researchTime : 0 }; |
369 | 369 | for (let type of resources.GetCodes()) |
370 | | ret.cost[type] = template.cost ? +template.cost[type] : 0; |
| 370 | ret.cost[type] = +(template.cost && template.cost[type] || 0); |
371 | 371 | |
372 | 372 | ret.tooltip = template.tooltip; |
373 | 373 | ret.requirementsTooltip = template.requirementsTooltip || ""; |
diff --git a/binaries/data/mods/public/gui/structree/draw.js b/binaries/data/mods/public/gui/structree/draw.js
index 44be50783..ffa34a0e3 100644
a
|
b
|
function draw()
|
183 | 183 | prod = g_ParsedData.units[prod]; |
184 | 184 | break; |
185 | 185 | case "techs": |
186 | | prod = clone(g_ParsedData.techs[civCode][prod]); |
| 186 | prod = clone(g_ParsedData.techs[g_SelectedCiv][prod]); |
187 | 187 | for (let res in trainer.techCostMultiplier) |
188 | 188 | if (prod.cost[res]) |
189 | 189 | prod.cost[res] *= trainer.techCostMultiplier[res]; |
diff --git a/binaries/data/mods/public/gui/structree/helper.js b/binaries/data/mods/public/gui/structree/helper.js
index da01b79e1..6ab61a583 100644
a
|
b
|
function GetPhaseOfTechnology(techName)
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if (!g_ParsedData.techs[g_SelectedCiv][techName]) |
83 | | warn(g_SelectedCiv + " : " + techName); |
| 83 | { |
| 84 | warn("The \"" + techName + "\" 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!"); |
| 85 | g_ParsedData.techs[g_SelectedCiv][techName] = loadTechnology(techName); |
| 86 | } |
| 87 | |
84 | 88 | let techReqs = g_ParsedData.techs[g_SelectedCiv][techName].reqs; |
85 | 89 | if (!techReqs) |
86 | 90 | return false; |
… |
… |
function GetPhaseOfTechnology(techName)
|
91 | 95 | { |
92 | 96 | if (basename(tech).slice(0, 5) === "phase") |
93 | 97 | return tech; |
| 98 | if (basename(tech).slice(0, 4) === "pair") |
| 99 | continue; |
94 | 100 | phaseIdx = Math.max(phaseIdx, g_ParsedData.phaseList.indexOf(GetPhaseOfTechnology(tech))); |
95 | 101 | } |
96 | 102 | return g_ParsedData.phaseList[phaseIdx] || false; |
diff --git a/binaries/data/mods/public/gui/structree/structree.js b/binaries/data/mods/public/gui/structree/structree.js
index 20f20fdcb..8b40b9e37 100644
a
|
b
|
function selectCiv(civCode)
|
245 | 245 | buildList[phase].push(structCode); |
246 | 246 | } |
247 | 247 | for (let unitCode of g_Lists.units) |
248 | | if (g_ParsedData.units[unitCode] && g_ParsedData.units[unitCode].production) |
| 248 | if (g_ParsedData.units[unitCode] && g_ParsedData.units[unitCode].production && Object.keys(g_ParsedData.units[unitCode].production).length) |
| 249 | { |
| 250 | // Splice out any `pair_*` techs for the actual techs of that pair |
| 251 | if (g_ParsedData.units[unitCode].production.techs) |
| 252 | for (let prod of g_ParsedData.units[unitCode].production.techs) |
| 253 | if (prod in techPairs) |
| 254 | g_ParsedData.units[unitCode].production.techs.splice( |
| 255 | g_ParsedData.units[unitCode].production.techs.indexOf(prod), |
| 256 | 1, ...techPairs[prod].techs |
| 257 | ); |
| 258 | |
249 | 259 | trainerList.push(unitCode); |
| 260 | } |
250 | 261 | |
251 | 262 | g_CivData[g_SelectedCiv].buildList = buildList; |
252 | 263 | g_CivData[g_SelectedCiv].trainList = trainerList; |