Merge branch 'master' of https://github.com/Anuken/Mindustry
This commit is contained in:
@@ -103,8 +103,12 @@ public class LVar{
|
||||
|
||||
public void set(LVar other){
|
||||
isobj = other.isobj;
|
||||
objval = other.objval;
|
||||
numval = other.numval;
|
||||
// Setting a non-numeric value to @counter must preserve its numeric field
|
||||
if(isobj){
|
||||
objval = other.objval;
|
||||
}else{
|
||||
numval = other.numval;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean invalid(double d){
|
||||
|
||||
@@ -46,6 +46,7 @@ public class ResearchDialog extends BaseDialog{
|
||||
|
||||
public ItemSeq items;
|
||||
|
||||
private final Seq<Planet> rootPlanets = new Seq<>(false, 4);
|
||||
private boolean showTechSelect;
|
||||
private boolean needsRebuild;
|
||||
|
||||
@@ -214,21 +215,30 @@ public class ResearchDialog extends BaseDialog{
|
||||
ObjectMap<Sector, ItemSeq> cache = new ObjectMap<>();
|
||||
|
||||
{
|
||||
//first, find a planet associated with the current tech tree
|
||||
Planet rootPlanet = lastNode.planet != null ? lastNode.planet : content.planets().find(p -> p.techTree == lastNode);
|
||||
//first, find a planets associated with the current tech tree
|
||||
rootPlanets.clear();
|
||||
for(var planet : content.planets()){
|
||||
if(planet.techTree == lastNode){
|
||||
rootPlanets.add(planet);
|
||||
}
|
||||
}
|
||||
|
||||
//if there is no root, fall back to serpulo
|
||||
if(rootPlanet == null) rootPlanet = Planets.serpulo;
|
||||
if(rootPlanets.size == 0){
|
||||
rootPlanets.add(Planets.serpulo);
|
||||
}
|
||||
|
||||
//add global counts of each sector
|
||||
for(Sector sector : rootPlanet.sectors){
|
||||
if(sector.hasBase()){
|
||||
ItemSeq cached = sector.items();
|
||||
cache.put(sector, cached);
|
||||
cached.each((item, amount) -> {
|
||||
values[item.id] += Math.max(amount, 0);
|
||||
total += Math.max(amount, 0);
|
||||
});
|
||||
for(Planet planet : rootPlanets){
|
||||
for(Sector sector : planet.sectors){
|
||||
if(sector.hasBase()){
|
||||
ItemSeq cached = sector.items();
|
||||
cache.put(sector, cached);
|
||||
cached.each((item, amount) -> {
|
||||
values[item.id] += Math.max(amount, 0);
|
||||
total += Math.max(amount, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user