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; info.slot = slot;
Dungeon.preview(info, bundle); Dungeon.preview(info, bundle);
//saves from before v0.8.0b are not supported //saves from before v0.9.0b are not supported
if (info.version < ShatteredPixelDungeon.v0_8_0b) { if (info.version < ShatteredPixelDungeon.v0_9_0b) {
info = null; info = null;
} }

View File

@ -34,11 +34,7 @@ import com.watabou.utils.PlatformSupport;
public class ShatteredPixelDungeon extends Game { public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion //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 //versions older than v0.9.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;
public static final int v0_9_0b = 489; public static final int v0_9_0b = 489;
public static final int v0_9_1d = 511; public static final int v0_9_1d = 511;
public static final int v0_9_2b = 531; public static final int v0_9_2b = 531;

View File

@ -152,46 +152,19 @@ public class Belongings implements Iterable<Item> {
backpack.restoreFromBundle( bundle ); backpack.restoreFromBundle( bundle );
weapon = (KindOfWeapon) bundle.get(WEAPON); weapon = (KindOfWeapon) bundle.get(WEAPON);
if (weapon() != null) { if (weapon() != null) weapon().activate(owner);
weapon().activate(owner);
}
armor = (Armor)bundle.get( ARMOR ); armor = (Armor)bundle.get( ARMOR );
if (armor() != null){ if (armor() != null) armor().activate( owner );
armor().activate( owner );
}
//pre-0.8.2 artifact = (Artifact) bundle.get(ARTIFACT);
if (bundle.contains("misc1") || bundle.contains("misc2")){ if (artifact() != null) artifact().activate(owner);
artifact = null;
misc = null;
ring = null;
KindofMisc m = (KindofMisc)bundle.get("misc1"); misc = (KindofMisc) bundle.get(MISC);
if (m instanceof Artifact){ if (misc() != null) misc().activate( owner );
artifact = (Artifact) m;
} else if (m instanceof Ring) {
ring = (Ring) m;
}
m = (KindofMisc)bundle.get("misc2"); ring = (Ring) bundle.get(RING);
if (m instanceof Artifact){ if (ring() != null) ring().activate( owner );
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);
if (misc() != null) misc().activate( owner );
if (ring() != null) ring().activate( owner );
} }
public static void preview( GamesInProgress.Info info, Bundle bundle ) { public static void preview( GamesInProgress.Info info, Bundle bundle ) {

View File

@ -674,18 +674,6 @@ 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 //general save/load
//includes "catalogs" for pre-0.8.2 saves if (bundle.contains(CATALOG_ITEMS)) {
if (bundle.contains("catalogs") || bundle.contains(CATALOG_ITEMS)) {
List<Class> seenClasses = new ArrayList<>(); List<Class> seenClasses = new ArrayList<>();
if (bundle.contains(CATALOG_ITEMS)) { if (bundle.contains(CATALOG_ITEMS)) {
seenClasses = Arrays.asList(bundle.getClassArray(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 (Catalog cat : values()) {
for (Class<? extends Item> item : cat.items()) { for (Class<? extends Item> item : cat.items()) {
if (seenClasses.contains(item) || seenItems.contains(item.getSimpleName())) { if (seenClasses.contains(item)) {
cat.seen.put(item, true); cat.seen.put(item, true);
} }
} }

View File

@ -157,20 +157,6 @@ public class CavesBossLevel extends Level {
customArenaVisuals = (ArenaVisuals) c; 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 @Override

View File

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

View File

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