Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/structree/structree.js
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | function selectCiv(civCode) | ||||
for (let pha of g_ParsedData.phaseList) | for (let pha of g_ParsedData.phaseList) | ||||
buildList[pha] = []; | buildList[pha] = []; | ||||
for (let structCode of g_Lists.structures) | for (let structCode of g_Lists.structures) | ||||
{ | { | ||||
let phase = g_ParsedData.structures[structCode].phase; | let phase = g_ParsedData.structures[structCode].phase; | ||||
buildList[phase].push(structCode); | buildList[phase].push(structCode); | ||||
} | } | ||||
for (let unitCode of g_Lists.units) | 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); | trainerList.push(unitCode); | ||||
} | |||||
g_CivData[g_SelectedCiv].buildList = buildList; | g_CivData[g_SelectedCiv].buildList = buildList; | ||||
g_CivData[g_SelectedCiv].trainList = trainerList; | g_CivData[g_SelectedCiv].trainList = trainerList; | ||||
draw(); | draw(); | ||||
} | } | ||||
function closeStrucTree() | function closeStrucTree() | ||||
{ | { | ||||
if (g_CallbackSet) | if (g_CallbackSet) | ||||
Engine.PopGuiPageCB(0); | Engine.PopGuiPageCB(0); | ||||
else | else | ||||
Engine.PopGuiPage(); | Engine.PopGuiPage(); | ||||
} | } |
Wildfire Games · Phabricator