Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/structree/draw.js
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | for (let stru of g_CivData[g_SelectedCiv].buildList[pha]) | ||||
let prod_pha = phaseList[phaseList.indexOf(pha) + r]; | let prod_pha = phaseList[phaseList.indexOf(pha) + r]; | ||||
if (stru.production.units[prod_pha]) | if (stru.production.units[prod_pha]) | ||||
for (let prod of stru.production.units[prod_pha]) | for (let prod of stru.production.units[prod_pha]) | ||||
{ | { | ||||
prod = g_ParsedData.units[prod]; | prod = g_ParsedData.units[prod]; | ||||
if (!drawProdIcon(i, s, r, p, prod)) | if (!drawProdIcon(i, s, r, p, prod)) | ||||
break; | break; | ||||
p++; | ++p; | ||||
} | |||||
if (stru.upgrades[prod_pha]) | |||||
for (let upgrade of stru.upgrades[prod_pha]) | |||||
{ | |||||
if (!drawProdIcon(i, s, r, p, upgrade)) | |||||
break; | |||||
elexis: For those wondering why it's a break and not a continue: `false`is only returned `if more… | |||||
++p; | |||||
} | } | ||||
if (stru.wallset && prod_pha == pha) | if (stru.wallset && prod_pha == pha) | ||||
for (let prod of [stru.wallset.gate, stru.wallset.tower]) | for (let prod of [stru.wallset.tower]) | ||||
bbUnsubmitted Not Done Inline ActionsLooping over an array with 1 element? nuke? bb: Looping over an array with 1 element? nuke? | |||||
s0600204AuthorUnsubmitted Not Done Inline ActionsHmm... I'll get that in the next patch, honest. s0600204: Hmm... I'll get that in the next patch, honest. | |||||
{ | { | ||||
if (!drawProdIcon(i, s, r, p, prod)) | if (!drawProdIcon(i, s, r, p, prod)) | ||||
break; | break; | ||||
p++; | ++p; | ||||
} | } | ||||
if (stru.production.technology[prod_pha]) | if (stru.production.technology[prod_pha]) | ||||
for (let prod of stru.production.technology[prod_pha]) | for (let prod of stru.production.technology[prod_pha]) | ||||
{ | { | ||||
prod = clone(basename(prod).slice(0,5) == "phase" ? | prod = clone(basename(prod).slice(0,5) == "phase" ? | ||||
g_ParsedData.phases[prod] : | g_ParsedData.phases[prod] : | ||||
g_ParsedData.techs[g_SelectedCiv][prod]); | g_ParsedData.techs[g_SelectedCiv][prod]); | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | for (let trainer of g_CivData[g_SelectedCiv].trainList) | ||||
} | } | ||||
trainer = g_ParsedData.units[trainer]; | trainer = g_ParsedData.units[trainer]; | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_icon").sprite = "stretched:session/portraits/"+trainer.icon; | Engine.GetGUIObjectByName("trainer["+t+"]_icon").sprite = "stretched:session/portraits/"+trainer.icon; | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_icon").tooltip = assembleTooltip(trainer); | Engine.GetGUIObjectByName("trainer["+t+"]_icon").tooltip = assembleTooltip(trainer); | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_name").caption = translate(trainer.name.specific); | Engine.GetGUIObjectByName("trainer["+t+"]_name").caption = translate(trainer.name.specific); | ||||
thisEle.hidden = false; | thisEle.hidden = false; | ||||
let p = 0; | let p = 0; | ||||
if (trainer.production) | |||||
Done Inline ActionsUnneeded pair of braces elexis: Unneeded pair of braces | |||||
for (let prodType in trainer.production) | for (let prodType in trainer.production) | ||||
{ | |||||
for (let prod of trainer.production[prodType]) | for (let prod of trainer.production[prodType]) | ||||
{ | { | ||||
switch (prodType) | switch (prodType) | ||||
{ | { | ||||
case "units": | case "units": | ||||
prod = g_ParsedData.units[prod]; | prod = g_ParsedData.units[prod]; | ||||
break; | break; | ||||
case "techs": | case "techs": | ||||
prod = clone(g_ParsedData.techs[civCode][prod]); | prod = clone(g_ParsedData.techs[civCode][prod]); | ||||
for (let res in trainer.techCostMultiplier) | for (let res in trainer.techCostMultiplier) | ||||
if (prod.cost[res]) | if (prod.cost[res]) | ||||
prod.cost[res] *= trainer.techCostMultiplier[res]; | prod.cost[res] *= trainer.techCostMultiplier[res]; | ||||
break; | break; | ||||
default: | default: | ||||
continue; | continue; | ||||
} | } | ||||
if (!drawProdIcon(null, t, null, p, prod)) | if (!drawProdIcon(null, t, null, p, prod)) | ||||
break; | break; | ||||
++p; | ++p; | ||||
} | } | ||||
if (trainer.upgrades) | |||||
for (let upgrade of trainer.upgrades) | |||||
{ | |||||
if (!drawProdIcon(null, t, null, p, upgrade.data)) | |||||
break; | |||||
++p; | |||||
} | } | ||||
hideRemaining("trainer["+t+"]_row", p); | hideRemaining("trainer["+t+"]_row", p); | ||||
let size = thisEle.size; | let size = thisEle.size; | ||||
size.right = size.left + Math.max(p*24, defWidth) + 4; | size.right = size.left + Math.max(p*24, defWidth) + 4; | ||||
thisEle.size = size; | thisEle.size = size; | ||||
let eleWidth = size.right - size.left; | let eleWidth = size.right - size.left; | ||||
let wid = p * 24 - 4; | let wid = p * 24 - 4; | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
For those wondering why it's a break and not a continue: falseis only returned if more production icons than can be supported by the current GUI layout.