Allow fetching unitCount by type, and buildCount without type (#9374)
* Allow fetching unitCount by type, and buildCount without type * show in processor ui
This commit is contained in:
@@ -1360,13 +1360,20 @@ public class LExecutor{
|
|||||||
exec.setobj(result, i < 0 || i >= builds.size ? null : builds.get(i));
|
exec.setobj(result, i < 0 || i >= builds.size ? null : builds.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case unitCount -> exec.setnum(result, data.units.size);
|
case unitCount -> {
|
||||||
|
UnitType type = exec.obj(extra) instanceof UnitType u ? u : null;
|
||||||
|
if(type == null){
|
||||||
|
exec.setnum(result, data.units.size);
|
||||||
|
}else{
|
||||||
|
exec.setnum(result, data.unitsByType[type.id].size);
|
||||||
|
}
|
||||||
|
}
|
||||||
case coreCount -> exec.setnum(result, data.cores.size);
|
case coreCount -> exec.setnum(result, data.cores.size);
|
||||||
case playerCount -> exec.setnum(result, data.players.size);
|
case playerCount -> exec.setnum(result, data.players.size);
|
||||||
case buildCount -> {
|
case buildCount -> {
|
||||||
Block block = exec.obj(extra) instanceof Block b ? b : null;
|
Block block = exec.obj(extra) instanceof Block b ? b : null;
|
||||||
if(block == null){
|
if(block == null){
|
||||||
exec.setobj(result, null);
|
exec.setnum(result, data.buildings.size);
|
||||||
}else{
|
}else{
|
||||||
exec.setnum(result, data.getBuildings(block).size);
|
exec.setnum(result, data.getBuildings(block).size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1748,7 +1748,7 @@ public class LStatements{
|
|||||||
fields(table, index, i -> index = i);
|
fields(table, index, i -> index = i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == FetchType.buildCount || type == FetchType.build){
|
if(type == FetchType.buildCount || type == FetchType.build || type == FetchType.unitCount){
|
||||||
row(table);
|
row(table);
|
||||||
|
|
||||||
fields(table, "block", extra, i -> extra = i);
|
fields(table, "block", extra, i -> extra = i);
|
||||||
|
|||||||
Reference in New Issue
Block a user