diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index fcad9b888f..64ebd5c21d 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1912,7 +1912,7 @@ public class Blocks implements ContentList{ new UnitType[]{UnitTypes.antumbra, UnitTypes.eclipse}, new UnitType[]{UnitTypes.arkyid, UnitTypes.toxopid}, new UnitType[]{UnitTypes.scepter, UnitTypes.reign}, - new UnitType[] {UnitTypes.sei, UnitTypes.omura}, + new UnitType[]{UnitTypes.sei, UnitTypes.omura}, new UnitType[]{UnitTypes.quad, UnitTypes.oct}, new UnitType[]{UnitTypes.vela, UnitTypes.corvus} ); diff --git a/core/src/mindustry/logic/LAssembler.java b/core/src/mindustry/logic/LAssembler.java index f353a8c38c..57c2004320 100644 --- a/core/src/mindustry/logic/LAssembler.java +++ b/core/src/mindustry/logic/LAssembler.java @@ -189,17 +189,28 @@ public class LAssembler{ return putConst("___" + symbol, symbol.substring(1, symbol.length() - 1).replace("\\n", "\n")).id; } + //remove spaces for non-strings + symbol = symbol.replace(' ', '_'); + try{ - double value = Double.parseDouble(symbol); + double value = parseDouble(symbol); if(Double.isNaN(value) || Double.isInfinite(value)) value = 0; + //this creates a hidden const variable with the specified value - String key = "___" + value; - return putConst(key, value).id; + return putConst("___" + value, value).id; }catch(NumberFormatException e){ return putVar(symbol).id; } } + double parseDouble(String symbol) throws NumberFormatException{ + //parse hex/binary syntax + if(symbol.startsWith("0b")) return Long.parseLong(symbol.substring(2), 2); + if(symbol.startsWith("0x")) return Long.parseLong(symbol.substring(2), 16); + + return Double.parseDouble(symbol); + } + /** Adds a constant value by name. */ public BVar putConst(String name, Object value){ BVar var = putVar(name); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 2d32588faa..8257ec10ee 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -491,7 +491,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ selected = null; } } - } });