Fixed two bugs reported by MrMouette

- NPE when adding first stage to a newly created quest
- Chance serialization issues.
This commit is contained in:
Zukero
2015-02-23 23:27:53 +01:00
parent 59d8ad1cdb
commit 327c870b17
3 changed files with 5 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.3.3";
public static final String APP_VERSION = "v0.3.4.dev";
public static boolean STARTED = false;
public static StudioFrame frame = null;

View File

@@ -160,7 +160,8 @@ public abstract class JSONElement extends GameDataElement {
else if (chance.equals(0.1d)) return "1/1000";
else if (chance.equals(0.01d)) return "1/10000";
else {
//TODO Better handling of fractions. Chance description need a complete rehaul in AT.
if (chance.intValue() == chance) return Integer.toString(chance.intValue());
//TODO Better handling of fractions. Chance description need a complete overhaul in AT.
//This part does not output the input content of parseDouble(String s) in the case of fractions.
return chance.toString();
}

View File

@@ -263,6 +263,7 @@ public class QuestEditor extends JSONElementEditor {
}
public void createStage() {
if (quest.stages == null) quest.stages = new ArrayList<Quest.QuestStage>();
quest.stages.add(new Quest.QuestStage());
for (TableModelListener l: listeners) {
l.tableChanged(new TableModelEvent(this, quest.stages.size() - 1));
@@ -283,6 +284,7 @@ public class QuestEditor extends JSONElementEditor {
for (TableModelListener l: listeners) {
l.tableChanged(new TableModelEvent(this, rowNumber, quest.stages.size()));
}
if (quest.stages.isEmpty()) quest.stages = null;
}
public List<TableModelListener> listeners = new ArrayList<TableModelListener>();