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 = {};
|
||||
// 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;
|
||||
|
||||
@ -168,7 +168,7 @@ function loadTechnology(techName)
|
||||
switch (op)
|
||||
{
|
||||
case "tech":
|
||||
tech.reqs.generic = [ req ];
|
||||
tech.reqs.generic = req;
|
||||
break;
|
||||
|
||||
case "civ":
|
||||
@ -190,8 +190,11 @@ function loadTechnology(techName)
|
||||
break;
|
||||
|
||||
case "all":
|
||||
for (let r of req[0])
|
||||
tech.reqs[r] = req[1];
|
||||
if (req[0].length < 1)
|
||||
tech.reqs.generic = req[1];
|
||||
else
|
||||
for (let r of req[0])
|
||||
tech.reqs[r] = req[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -242,10 +245,14 @@ function calcReqs(op, val)
|
||||
switch (op)
|
||||
{
|
||||
case "civ":
|
||||
case "tech":
|
||||
// nothing needs doing
|
||||
break;
|
||||
|
||||
case "tech":
|
||||
if (depath(val).slice(0,4) === "pair")
|
||||
return loadTechnologyPair(val).techs;
|
||||
return [ val ];
|
||||
|
||||
case "all":
|
||||
case "any":
|
||||
let t = [];
|
||||
@ -263,7 +270,7 @@ function calcReqs(op, val)
|
||||
break;
|
||||
|
||||
case "tech":
|
||||
t.push(r);
|
||||
t = t.concat(r);
|
||||
break;
|
||||
|
||||
case "any":
|
||||
@ -328,6 +335,11 @@ function unravelPhases(techs)
|
||||
phaseList.splice(myPhasePos, 0, reqPhase);
|
||||
else if (myPhasePos < 0 && reqPhasePos > -1)
|
||||
phaseList.splice(reqPhasePos+1, 0, myPhase);
|
||||
else if (reqPhasePos > myPhasePos)
|
||||
{
|
||||
phaseList.splice(reqPhasePos+1, 0, myPhase);
|
||||
phaseList.splice(myPhasePos, 1);
|
||||
}
|
||||
}
|
||||
return phaseList;
|
||||
}
|
||||
|
@ -170,12 +170,15 @@ function selectCiv(civCode)
|
||||
}
|
||||
else if (g_SelectedCiv in g_ParsedData.techs[prod].reqs)
|
||||
{
|
||||
if (g_ParsedData.techs[prod].reqs[g_SelectedCiv].length > 0)
|
||||
phase = g_ParsedData.techs[prod].reqs[g_SelectedCiv][0];
|
||||
for (let req of g_ParsedData.techs[prod].reqs[g_SelectedCiv])
|
||||
if (depath(req).slice(0,5) === "phase")
|
||||
phase = req;
|
||||
}
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user