Some structree improvements for issues exposed by mods. Changes by s0600204.
This was SVN commit r16463.
This commit is contained in:
parent
c73c9370ee
commit
5950d16500
@ -111,7 +111,7 @@ function loadStructure(templateName)
|
|||||||
{
|
{
|
||||||
structure.wallset = {};
|
structure.wallset = {};
|
||||||
// Note: Assume wall segments of all lengths have the same armor
|
// Note: Assume wall segments of all lengths have the same armor
|
||||||
structure.armour = loadStructure(structure.wallSet.templates["long"]).armour;
|
structure.armour = loadStructure(structure.wallSet.templates.long).armour;
|
||||||
|
|
||||||
let health;
|
let health;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ function loadTechnology(techName)
|
|||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case "tech":
|
case "tech":
|
||||||
tech.reqs.generic = [ req ];
|
tech.reqs.generic = req;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "civ":
|
case "civ":
|
||||||
@ -190,8 +190,11 @@ function loadTechnology(techName)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "all":
|
case "all":
|
||||||
for (let r of req[0])
|
if (req[0].length < 1)
|
||||||
tech.reqs[r] = req[1];
|
tech.reqs.generic = req[1];
|
||||||
|
else
|
||||||
|
for (let r of req[0])
|
||||||
|
tech.reqs[r] = req[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,10 +245,14 @@ function calcReqs(op, val)
|
|||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case "civ":
|
case "civ":
|
||||||
case "tech":
|
|
||||||
// nothing needs doing
|
// nothing needs doing
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "tech":
|
||||||
|
if (depath(val).slice(0,4) === "pair")
|
||||||
|
return loadTechnologyPair(val).techs;
|
||||||
|
return [ val ];
|
||||||
|
|
||||||
case "all":
|
case "all":
|
||||||
case "any":
|
case "any":
|
||||||
let t = [];
|
let t = [];
|
||||||
@ -263,7 +270,7 @@ function calcReqs(op, val)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "tech":
|
case "tech":
|
||||||
t.push(r);
|
t = t.concat(r);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "any":
|
case "any":
|
||||||
@ -328,6 +335,11 @@ function unravelPhases(techs)
|
|||||||
phaseList.splice(myPhasePos, 0, reqPhase);
|
phaseList.splice(myPhasePos, 0, reqPhase);
|
||||||
else if (myPhasePos < 0 && reqPhasePos > -1)
|
else if (myPhasePos < 0 && reqPhasePos > -1)
|
||||||
phaseList.splice(reqPhasePos+1, 0, myPhase);
|
phaseList.splice(reqPhasePos+1, 0, myPhase);
|
||||||
|
else if (reqPhasePos > myPhasePos)
|
||||||
|
{
|
||||||
|
phaseList.splice(reqPhasePos+1, 0, myPhase);
|
||||||
|
phaseList.splice(myPhasePos, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return phaseList;
|
return phaseList;
|
||||||
}
|
}
|
||||||
|
@ -170,12 +170,15 @@ function selectCiv(civCode)
|
|||||||
}
|
}
|
||||||
else if (g_SelectedCiv in g_ParsedData.techs[prod].reqs)
|
else if (g_SelectedCiv in g_ParsedData.techs[prod].reqs)
|
||||||
{
|
{
|
||||||
if (g_ParsedData.techs[prod].reqs[g_SelectedCiv].length > 0)
|
for (let req of g_ParsedData.techs[prod].reqs[g_SelectedCiv])
|
||||||
phase = g_ParsedData.techs[prod].reqs[g_SelectedCiv][0];
|
if (depath(req).slice(0,5) === "phase")
|
||||||
|
phase = req;
|
||||||
}
|
}
|
||||||
else if ("generic" in g_ParsedData.techs[prod].reqs)
|
else if ("generic" in g_ParsedData.techs[prod].reqs)
|
||||||
{
|
{
|
||||||
phase = g_ParsedData.techs[prod].reqs.generic[0];
|
for (let req of g_ParsedData.techs[prod].reqs.generic)
|
||||||
|
if (depath(req).slice(0,5) === "phase")
|
||||||
|
phase = req;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depath(phase).slice(0,5) !== "phase")
|
if (depath(phase).slice(0,5) !== "phase")
|
||||||
|
Loading…
Reference in New Issue
Block a user