mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
fixed the Quest mode issue
This commit is contained in:
@@ -8,6 +8,8 @@ import java.io.ObjectStreamException;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,11 +31,15 @@ public class QuestData_State implements Serializable {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws ObjectStreamException {
|
||||||
// System.out.println("resolving obsolete QuestData_State");
|
// System.out.println("resolving obsolete QuestData_State");
|
||||||
//removing generic types to make cast between Deck and forge.Deck
|
Map<String, forge.Deck> myDecks = new HashMap<String, forge.Deck>();
|
||||||
//i'm using Deck in this class because it may be somewhere in the serialization stream
|
for(Entry<String, Deck> deck:this.myDecks.entrySet()) {
|
||||||
//it is irrelevant, because readResolve replaces Deck by forge.Deck, and since generics
|
myDecks.put(deck.getKey(), deck.getValue().migrate());
|
||||||
//aren't checked at runtime, the cast is ok.
|
}
|
||||||
return new forge.QuestData_State(rankIndex, win, lost, difficulty, cardPool, (HashMap) myDecks,
|
|
||||||
(HashMap) aiDecks);
|
Map<String, forge.Deck> aiDecks = new HashMap<String, forge.Deck>();
|
||||||
|
for(Entry<String, Deck> deck:this.aiDecks.entrySet()) {
|
||||||
|
aiDecks.put(deck.getKey(), deck.getValue().migrate());
|
||||||
|
}
|
||||||
|
return new forge.QuestData_State(rankIndex, win, lost, difficulty, cardPool, myDecks, aiDecks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class QuestData implements NewConstants {
|
|||||||
private ArrayList<String> mediumAIDecks;
|
private ArrayList<String> mediumAIDecks;
|
||||||
private ArrayList<String> hardAIDecks;
|
private ArrayList<String> hardAIDecks;
|
||||||
|
|
||||||
private HashMap<String, Deck> myDecks = new HashMap<String, Deck>();
|
private Map<String, Deck> myDecks = new HashMap<String, Deck>();
|
||||||
private HashMap<String, Deck> aiDecks = new HashMap<String, Deck>();
|
private Map<String, Deck> aiDecks = new HashMap<String, Deck>();
|
||||||
|
|
||||||
//holds String card names
|
//holds String card names
|
||||||
private ArrayList<String> cardPool = new ArrayList<String>();
|
private ArrayList<String> cardPool = new ArrayList<String>();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package forge;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +27,7 @@ public class QuestData_State implements Serializable {
|
|||||||
String difficulty;
|
String difficulty;
|
||||||
|
|
||||||
ArrayList<String> cardPool;
|
ArrayList<String> cardPool;
|
||||||
HashMap<String, Deck> myDecks, aiDecks;
|
Map<String, Deck> myDecks, aiDecks;
|
||||||
|
|
||||||
public QuestData_State() {}
|
public QuestData_State() {}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public class QuestData_State implements Serializable {
|
|||||||
* This constructor is used by QestData_State in the default package to create a replacement object for the
|
* This constructor is used by QestData_State in the default package to create a replacement object for the
|
||||||
* obsolete class.
|
* obsolete class.
|
||||||
*/
|
*/
|
||||||
public QuestData_State(int rankIndex, int win, int lost, String difficulty, ArrayList<String> cardPool, HashMap<String, Deck> myDecks, HashMap<String, Deck> aiDecks) {
|
public QuestData_State(int rankIndex, int win, int lost, String difficulty, ArrayList<String> cardPool, Map<String, Deck> myDecks, Map<String, Deck> aiDecks) {
|
||||||
this.rankIndex = rankIndex;
|
this.rankIndex = rankIndex;
|
||||||
this.win = win;
|
this.win = win;
|
||||||
this.lost = lost;
|
this.lost = lost;
|
||||||
|
|||||||
Reference in New Issue
Block a user