v1.1.0: dropped support for saves prior to v0.9.0b

This commit is contained in:
Evan Debenham 2021-09-22 22:02:20 -04:00
parent e582de3132
commit 5a091dd781
8 changed files with 16 additions and 82 deletions

View File

@ -102,8 +102,8 @@ public class GamesInProgress {
info.slot = slot;
Dungeon.preview(info, bundle);
//saves from before v0.8.0b are not supported
if (info.version < ShatteredPixelDungeon.v0_8_0b) {
//saves from before v0.9.0b are not supported
if (info.version < ShatteredPixelDungeon.v0_9_0b) {
info = null;
}

View File

@ -34,11 +34,7 @@ import com.watabou.utils.PlatformSupport;
public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion
//versions older than v0.8.0b are no longer supported, and data from them is ignored
public static final int v0_8_0b = 414;
public static final int v0_8_1a = 422;
public static final int v0_8_2d = 463;
//versions older than v0.9.0b are no longer supported, and data from them is ignored
public static final int v0_9_0b = 489;
public static final int v0_9_1d = 511;
public static final int v0_9_2b = 531;

View File

@ -152,45 +152,18 @@ public class Belongings implements Iterable<Item> {
backpack.restoreFromBundle( bundle );
weapon = (KindOfWeapon) bundle.get(WEAPON);
if (weapon() != null) {
weapon().activate(owner);
}
if (weapon() != null) weapon().activate(owner);
armor = (Armor)bundle.get( ARMOR );
if (armor() != null){
armor().activate( owner );
}
if (armor() != null) armor().activate( owner );
//pre-0.8.2
if (bundle.contains("misc1") || bundle.contains("misc2")){
artifact = null;
misc = null;
ring = null;
KindofMisc m = (KindofMisc)bundle.get("misc1");
if (m instanceof Artifact){
artifact = (Artifact) m;
} else if (m instanceof Ring) {
ring = (Ring) m;
}
m = (KindofMisc)bundle.get("misc2");
if (m instanceof Artifact){
if (artifact == null) artifact = (Artifact) m;
else misc = (Artifact) m;
} else if (m instanceof Ring) {
if (ring == null) ring = (Ring) m;
else misc = (Ring) m;
}
} else {
artifact = (Artifact) bundle.get(ARTIFACT);
misc = (KindofMisc) bundle.get(MISC);
ring = (Ring) bundle.get(RING);
}
if (artifact() != null) artifact().activate(owner);
misc = (KindofMisc) bundle.get(MISC);
if (misc() != null) misc().activate( owner );
ring = (Ring) bundle.get(RING);
if (ring() != null) ring().activate( owner );
}

View File

@ -675,17 +675,5 @@ public class Generator {
}
}
//pre-0.8.1
if (bundle.contains("spawned_artifacts")) {
for (Class<? extends Artifact> artifact : bundle.getClassArray("spawned_artifacts")) {
Category cat = Category.ARTIFACT;
for (int i = 0; i < cat.classes.length; i++) {
if (cat.classes[i].equals(artifact)) {
cat.probs[i] = 0;
}
}
}
}
}
}

View File

@ -334,21 +334,15 @@ public enum Catalog {
}
//general save/load
//includes "catalogs" for pre-0.8.2 saves
if (bundle.contains("catalogs") || bundle.contains(CATALOG_ITEMS)) {
if (bundle.contains(CATALOG_ITEMS)) {
List<Class> seenClasses = new ArrayList<>();
if (bundle.contains(CATALOG_ITEMS)) {
seenClasses = Arrays.asList(bundle.getClassArray(CATALOG_ITEMS));
}
List<String> seenItems = new ArrayList<>();
if (bundle.contains("catalogs")) {
Journal.saveNeeded = true; //we want to overwrite with the newer storage format
seenItems = Arrays.asList(bundle.getStringArray("catalogs"));
}
for (Catalog cat : values()) {
for (Class<? extends Item> item : cat.items()) {
if (seenClasses.contains(item) || seenItems.contains(item.getSimpleName())) {
if (seenClasses.contains(item)) {
cat.seen.put(item, true);
}
}

View File

@ -157,20 +157,6 @@ public class CavesBossLevel extends Level {
customArenaVisuals = (ArenaVisuals) c;
}
}
//pre-0.8.1 saves that may not have had pylons added
int gatePos = pointToCell(new Point(gate.left, gate.top));
if (!locked && solid[gatePos]){
for (int i : pylonPositions) {
if (findMob(i) == null) {
Pylon pylon = new Pylon();
pylon.pos = i;
mobs.add(pylon);
}
}
}
}
@Override

View File

@ -309,8 +309,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION );
//saves from before v0.8.0b are not supported
if (version < ShatteredPixelDungeon.v0_8_0b){
//saves from before v0.9.0b are not supported
if (version < ShatteredPixelDungeon.v0_9_0b){
throw new RuntimeException("old save");
}

View File

@ -75,7 +75,6 @@ public class PrisonBossLevel extends Level {
public enum State {
START,
FIGHT_START,
TRAP_MAZES, //pre-0.8.1 saves
FIGHT_PAUSE,
FIGHT_ARENA,
WON
@ -118,7 +117,7 @@ public class PrisonBossLevel extends Level {
state = bundle.getEnum( STATE, State.class );
//in some states tengu won't be in the world, in others he will be.
if (state == State.START || state == State.TRAP_MAZES || state == State.FIGHT_PAUSE) {
if (state == State.START || state == State.FIGHT_PAUSE) {
tengu = (Tengu)bundle.get( TENGU );
} else {
for (Mob mob : mobs){
@ -417,7 +416,6 @@ public class PrisonBossLevel extends Level {
state = State.FIGHT_PAUSE;
break;
case TRAP_MAZES: //for pre-0.8.1 saves
case FIGHT_PAUSE:
Dungeon.hero.interrupt();
@ -503,7 +501,6 @@ public class PrisonBossLevel extends Level {
progress();
}
break;
case TRAP_MAZES: //pre-0.8.1
case FIGHT_PAUSE:
if (cellToPoint(ch.pos).y <= startHallway.top+1){