mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
everything from the default package moved to package forge. the default package contains classes Deck and QuestData_State to keep compatibility with old files that store serialized objects of these classes if you find other classes that are stored in the res directory through serialization, create a class for it in the default package or tell me. about QuestData_State: i'm getting a NullPointerException when trying to create/resume quest. Maybe the quest files on SVN are simply out of date. otherwise, that seems hard. easy fix would of course be to replace null by a new Map
40 lines
1.4 KiB
Java
40 lines
1.4 KiB
Java
/**
|
|
* QuestData_State.java
|
|
*
|
|
* Created on 26.10.2009
|
|
*/
|
|
|
|
import java.io.ObjectStreamException;
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
|
|
|
|
/**
|
|
* The class QuestData_State. This class is only here for compatibility with forge versions 10/17 and older. When
|
|
* it is read from the file stream, the object is replaced with an object of type {@link Deck} using
|
|
* {@link #readResolve()}.
|
|
*
|
|
* @author Clemens Koza
|
|
*/
|
|
public class QuestData_State implements Serializable {
|
|
private static final long serialVersionUID = 7007940230351051937L;
|
|
|
|
int rankIndex, win, lost;
|
|
String difficulty;
|
|
|
|
ArrayList<String> cardPool;
|
|
HashMap<String, Deck> myDecks, aiDecks;
|
|
|
|
@SuppressWarnings("unchecked")
|
|
private Object readResolve() throws ObjectStreamException {
|
|
System.out.println("resolving obsolete QuestData_State");
|
|
//removing generic types to make cast between Deck and forge.Deck
|
|
//i'm using Deck in this class because it may be somewhere in the serialization stream
|
|
//it is irrelevant, because readResolve replaces Deck by forge.Deck, and since generics
|
|
//aren't checked at runtime, the cast is ok.
|
|
return new forge.QuestData_State(rankIndex, win, lost, difficulty, cardPool, (HashMap) myDecks,
|
|
(HashMap) aiDecks);
|
|
}
|
|
}
|