From 9736e3eeebd3abaf3a82349bb7453fc4afd18169 Mon Sep 17 00:00:00 2001 From: Robin K Date: Wed, 30 Mar 2022 15:51:19 +0200 Subject: [PATCH] Cleanup --- src/main/java/com/romraider/maps/DataCell.java | 3 --- src/main/java/com/romraider/maps/DataCellView.java | 2 +- src/main/java/com/romraider/maps/TableBitwiseSwitch.java | 6 ++++-- src/main/java/com/romraider/maps/TableView.java | 2 +- src/main/java/com/romraider/xml/TableScaleUnmarshaller.java | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/romraider/maps/DataCell.java b/src/main/java/com/romraider/maps/DataCell.java index 4d4ea923..95d730e7 100644 --- a/src/main/java/com/romraider/maps/DataCell.java +++ b/src/main/java/com/romraider/maps/DataCell.java @@ -64,7 +64,6 @@ public class DataCell implements Serializable { this.table = table; this.rom = rom; setBitMask(table.getBitMask()); //Take the global bitmask first - calcValueRange(); } public DataCell(Table table, String staticText, Rom rom) { @@ -130,14 +129,12 @@ public class DataCell implements Serializable { } } else { - if(bitMask == 0) { maxAllowedBin = (Math.pow(256, table.getStorageType()) - 1); } else { maxAllowedBin =(int)(Math.pow(2,ByteUtil.lengthOfMask(bitMask)) - 1); } - minAllowedBin = 0.0; } } else { diff --git a/src/main/java/com/romraider/maps/DataCellView.java b/src/main/java/com/romraider/maps/DataCellView.java index a132304f..e7bcc397 100644 --- a/src/main/java/com/romraider/maps/DataCellView.java +++ b/src/main/java/com/romraider/maps/DataCellView.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2021 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/main/java/com/romraider/maps/TableBitwiseSwitch.java b/src/main/java/com/romraider/maps/TableBitwiseSwitch.java index 006c25e5..485e1464 100644 --- a/src/main/java/com/romraider/maps/TableBitwiseSwitch.java +++ b/src/main/java/com/romraider/maps/TableBitwiseSwitch.java @@ -68,7 +68,9 @@ public class TableBitwiseSwitch extends TableSwitch { @Override public void setPresetValues(String name, String bitPos) { - bits.add(Integer.parseInt(bitPos)); - super.setPresetValues(name, "1", bits.size() - 1); + if (bitPos != null && bitPos.length() > 0) { + bits.add(Integer.parseInt(bitPos)); + super.setPresetValues(name, "1", bits.size() - 1); + } } } diff --git a/src/main/java/com/romraider/maps/TableView.java b/src/main/java/com/romraider/maps/TableView.java index 24941788..6132d0cf 100644 --- a/src/main/java/com/romraider/maps/TableView.java +++ b/src/main/java/com/romraider/maps/TableView.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2021 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java b/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java index ccdbad56..0eaead46 100644 --- a/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java +++ b/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java @@ -299,7 +299,7 @@ public class TableScaleUnmarshaller { } else if (n.getNodeName().equalsIgnoreCase("bit")) { table.setPresetValues( unmarshallAttribute(n, "name", ""), - unmarshallAttribute(n, "position", "0")); + unmarshallAttribute(n, "position", "")); } else { /* unexpected element in Table (skip) */ }