v0.6.5: updated version info, dropped support for pre-0.6.0b saves

This commit is contained in:
Evan Debenham 2018-04-24 01:56:41 -04:00 committed by Evan Debenham
parent bd43201e95
commit 2cf3a16feb
5 changed files with 9 additions and 41 deletions

View File

@ -103,8 +103,8 @@ public class GamesInProgress {
info.slot = slot; info.slot = slot;
Dungeon.preview(info, bundle); Dungeon.preview(info, bundle);
//saves from before 0.5.0b are not supported //saves from before 0.6.0b are not supported
if (info.version < ShatteredPixelDungeon.v0_5_0b) { if (info.version < ShatteredPixelDungeon.v0_6_0b) {
info = null; info = null;
} }

View File

@ -40,44 +40,20 @@ import javax.microedition.khronos.opengles.GL10;
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.5.0b are no longer supported, and data from them is ignored //versions older than v0.6.0b are no longer supported, and data from them is ignored
public static final int v0_5_0b = 159;
public static final int v0_6_0b = 185; public static final int v0_6_0b = 185;
public static final int v0_6_1b = 209; public static final int v0_6_1b = 209;
public static final int v0_6_2e = 229; public static final int v0_6_2e = 229;
public static final int v0_6_3c = 245; public static final int v0_6_3b = 245;
public static final int v0_6_4 = 251; public static final int v0_6_4a = 252;
public ShatteredPixelDungeon() { public ShatteredPixelDungeon() {
super( WelcomeScene.class ); super( WelcomeScene.class );
//v0.6.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom.Bones.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.MassGravePainter$Bones" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.RitualSiteRoom.RitualMarker.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.RitualSitePainter$RitualMarker" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.WeakFloorRoom.HiddenWell.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.WeakFloorPainter$HiddenWell" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.Room" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Shortsword.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.NewShortsword" );
//v0.6.0a
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation.class,
"com.shatteredpixel.shatteredpixeldungeon.items.food.OverpricedRation" );
//v0.6.2 //v0.6.2
com.watabou.utils.Bundle.addAlias( com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom.class, com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom.class,

View File

@ -285,8 +285,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION ); version = bundle.getInt( VERSION );
//saves from before 0.5.0b are not supported //saves from before 0.6.0b are not supported
if (version < ShatteredPixelDungeon.v0_5_0b){ if (version < ShatteredPixelDungeon.v0_6_0b){
throw new RuntimeException("old save"); throw new RuntimeException("old save");
} }

View File

@ -203,9 +203,6 @@ public abstract class RegularLevel extends Level {
for (int i = 0; i < ((StandardRoom) room).sizeCat.roomValue; i++) { for (int i = 0; i < ((StandardRoom) room).sizeCat.roomValue; i++) {
stdRooms.add(room); stdRooms.add(room);
} }
//pre-0.6.0 save compatibility
} else if (room.legacyType.equals("STANDARD")){
stdRooms.add(room);
} }
} }
Random.shuffle(stdRooms); Random.shuffle(stdRooms);
@ -391,9 +388,7 @@ public abstract class RegularLevel extends Level {
protected Room randomRoom( Class<?extends Room> type ) { protected Room randomRoom( Class<?extends Room> type ) {
Random.shuffle( rooms ); Random.shuffle( rooms );
for (Room r : rooms) { for (Room r : rooms) {
if (type.isInstance(r) if (type.isInstance(r)) {
//compatibility with pre-0.6.0 saves
|| (type == StandardRoom.class && r.legacyType.equals("STANDARD"))) {
return r; return r;
} }
} }

View File

@ -33,10 +33,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
//Note that this class should be treated as if it were abstract public abstract class Room extends Rect implements Graph.Node, Bundlable {
// it is currently not abstract to maintain compatibility with pre-0.6.0 saves
// TODO make this class abstract after dropping support for pre-0.6.0 saves
public class Room extends Rect implements Graph.Node, Bundlable {
public ArrayList<Room> neigbours = new ArrayList<Room>(); public ArrayList<Room> neigbours = new ArrayList<Room>();
public LinkedHashMap<Room, Door> connected = new LinkedHashMap<Room, Door>(); public LinkedHashMap<Room, Door> connected = new LinkedHashMap<Room, Door>();