Great cleanup
This commit is contained in:
@@ -283,7 +283,7 @@ public class LCanvas extends Table{
|
||||
t.add().growX();
|
||||
|
||||
t.button(Icon.copy, Styles.logici, () -> {
|
||||
}).padRight(6).get().tapped(() -> copy());
|
||||
}).padRight(6).get().tapped(this::copy);
|
||||
|
||||
t.button(Icon.cancel, Styles.logici, () -> {
|
||||
remove();
|
||||
|
||||
@@ -32,15 +32,15 @@ public class LExecutor{
|
||||
|
||||
//special variables
|
||||
public static final int
|
||||
varCounter = 0,
|
||||
varTime = 1,
|
||||
varUnit = 2,
|
||||
varThis = 3;
|
||||
varCounter = 0,
|
||||
varTime = 1,
|
||||
varUnit = 2,
|
||||
varThis = 3;
|
||||
|
||||
public static final int
|
||||
maxGraphicsBuffer = 256,
|
||||
maxDisplayBuffer = 1024,
|
||||
maxTextBuffer = 256;
|
||||
maxGraphicsBuffer = 256,
|
||||
maxDisplayBuffer = 1024,
|
||||
maxTextBuffer = 256;
|
||||
|
||||
public LInstruction[] instructions = {};
|
||||
public Var[] vars = {};
|
||||
@@ -61,8 +61,9 @@ public class LExecutor{
|
||||
vars[varTime].numval = Time.millis();
|
||||
|
||||
//reset to start
|
||||
if(vars[varCounter].numval >= instructions.length
|
||||
|| vars[varCounter].numval < 0) vars[varCounter].numval = 0;
|
||||
if(vars[varCounter].numval >= instructions.length || vars[varCounter].numval < 0){
|
||||
vars[varCounter].numval = 0;
|
||||
}
|
||||
|
||||
if(vars[varCounter].numval < instructions.length){
|
||||
instructions[(int)(vars[varCounter].numval++)].run(this);
|
||||
@@ -84,9 +85,9 @@ public class LExecutor{
|
||||
|
||||
dest.constant = var.constant;
|
||||
|
||||
if(var.value instanceof Number){
|
||||
if(var.value instanceof Number number){
|
||||
dest.isobj = false;
|
||||
dest.numval = ((Number)var.value).doubleValue();
|
||||
dest.numval = number.doubleValue();
|
||||
}else{
|
||||
dest.isobj = true;
|
||||
dest.objval = var.value;
|
||||
@@ -98,7 +99,7 @@ public class LExecutor{
|
||||
|
||||
public @Nullable Building building(int index){
|
||||
Object o = vars[index].objval;
|
||||
return vars[index].isobj && o instanceof Building ? (Building)o : null;
|
||||
return vars[index].isobj && o instanceof Building building ? building : null;
|
||||
}
|
||||
|
||||
public @Nullable Object obj(int index){
|
||||
|
||||
@@ -4,7 +4,7 @@ import arc.math.*;
|
||||
import arc.util.*;
|
||||
|
||||
public enum LogicOp{
|
||||
add("+", (a, b) -> a + b),
|
||||
add("+", Double::sum),
|
||||
sub("-", (a, b) -> a - b),
|
||||
mul("*", (a, b) -> a * b),
|
||||
div("/", (a, b) -> a / b),
|
||||
@@ -29,7 +29,7 @@ public enum LogicOp{
|
||||
noise("noise", LExecutor.noise::rawNoise2D),
|
||||
|
||||
not("not", a -> ~(long)(a)),
|
||||
abs("abs", a -> Math.abs(a)),
|
||||
abs("abs", Math::abs),
|
||||
log("log", Math::log),
|
||||
log10("log10", Math::log10),
|
||||
sin("sin", d -> Math.sin(d * 0.017453292519943295D)),
|
||||
|
||||
Reference in New Issue
Block a user