v0.7.2: removed support for save data from v0.6.0 and v0.6.1

This commit is contained in:
Evan Debenham 2019-01-29 14:00:19 -05:00
parent 247cfc1f97
commit 2b867c98c2
9 changed files with 12 additions and 141 deletions

View File

@ -149,26 +149,6 @@ public class Dungeon {
}
}
//for saves prior to 0.6.1
public static void legacyRestore( int[] counts ){
STRENGTH_POTIONS.count = counts[0];
UPGRADE_SCROLLS.count = counts[1];
ARCANE_STYLI.count = counts[2];
SWARM_HP.count = counts[3];
BAT_HP.count = counts[4];
WARLOCK_HP.count = counts[5];
SCORPIO_HP.count = counts[6];
COOKING_HP.count = counts[7];
BLANDFRUIT_SEED.count = counts[8];
THIEVES_ARMBAND.count = counts[9];
DEW_VIAL.count = counts[10];
VELVET_POUCH.count = counts[11];
SCROLL_HOLDER.count = counts[12];
POTION_BANDOLIER.count = counts[13];
MAGICAL_HOLSTER.count = counts[14];
GUARD_HP.count = counts[15];
}
}
public static int challenges;
@ -615,13 +595,8 @@ public class Dungeon {
quickslot.restorePlaceholders( bundle );
if (fullLoad) {
//pre-0.6.1
if( bundle.contains("limiteddrops") ){
LimitedDrops.legacyRestore( bundle.getIntArray("limiteddrops") );
} else {
LimitedDrops.restore( bundle.getBundle(LIMDROPS) );
}
LimitedDrops.restore( bundle.getBundle(LIMDROPS) );
chapters = new HashSet<Integer>();
int ids[] = bundle.getIntArray( CHAPTERS );

View File

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

View File

@ -40,9 +40,7 @@ import javax.microedition.khronos.opengles.GL10;
public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion
//versions older than v0.6.0b are no longer supported, and data from them is ignored
public static final int v0_6_0b = 185;
public static final int v0_6_1b = 209;
//versions older than v0.6.2e are no longer supported, and data from them is ignored
public static final int v0_6_2e = 229;
public static final int v0_6_3b = 245;
public static final int v0_6_4a = 252;
@ -54,40 +52,6 @@ public class ShatteredPixelDungeon extends Game {
public ShatteredPixelDungeon() {
super( WelcomeScene.class );
//v0.6.2
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RatKingRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.PlantsRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.GardenRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.GardenRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.FoliageRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornDartTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonDartTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.ParalyticTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.SpearTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity.class,
"com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity" );
//v0.6.3
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk.class,

View File

@ -26,8 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class Alchemy extends Blob implements AlchemyScene.AlchemyProvider {
@ -45,16 +43,6 @@ public class Alchemy extends Blob implements AlchemyScene.AlchemyProvider {
if (off[cell] > 0 && Dungeon.level.heroFOV[cell]){
Notes.add( Notes.Landmark.ALCHEMY );
}
//for pre-0.6.2 saves
while (off[cell] > 0 && Dungeon.level.heaps.get(cell) != null){
int n;
do {
n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Dungeon.level.passable[n]);
Dungeon.level.drop( Dungeon.level.heaps.get(cell).pickUp(), n ).sprite.drop( pos );
}
}
}
}

View File

@ -29,13 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
@ -82,29 +78,6 @@ public class Belongings implements Iterable<Item> {
}
public void restoreFromBundle( Bundle bundle ) {
//moving keys to Notes, for pre-0.6.1 saves
if (bundle.contains("ironKeys")) {
int[] ironKeys = bundle.getIntArray( "ironKeys" );
for (int i = 0; i < ironKeys.length; i++){
if (ironKeys[i] > 0){
Notes.add((Key) new IronKey(i).quantity(ironKeys[i]));
}
}
}
if (bundle.contains("specialKeys")) {
int[] specialKeys = bundle.getIntArray( "specialKeys" );
for (int i = 0; i < specialKeys.length; i++){
if (specialKeys[i] > 0){
if (i % 5 == 0){
Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i]));
} else {
Notes.add((Key) new GoldenKey(i).quantity(specialKeys[i]));
}
}
}
}
backpack.clear();
backpack.restoreFromBundle( bundle );

View File

@ -661,19 +661,10 @@ public class Generator {
}
initArtifacts();
if (bundle.contains(SPAWNED_ARTIFACTS)){
for ( Class<?extends Artifact> artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){
removeArtifact(artifact);
}
//pre-0.6.1 saves
} else if (bundle.contains("artifacts")) {
String[] names = bundle.getStringArray("artifacts");
Category cat = Category.ARTIFACT;
for (String artifact : names)
for (int i = 0; i < cat.classes.length; i++)
if (cat.classes[i].getSimpleName().equals(artifact))
cat.probs[i] = 0;
for ( Class<?extends Artifact> artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){
removeArtifact(artifact);
}
}
}

View File

@ -165,12 +165,6 @@ public class CloakOfShadows extends Artifact {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
stealthed = bundle.getBoolean( STEALTHED );
// pre-0.6.2 saves
if (bundle.contains("cooldown")){
exp = 0;
level((int)Math.ceil(level()*0.7f));
charge = chargeCap = Math.min(3 + level(), 10);
}
}
@Override

View File

@ -200,16 +200,7 @@ public class HornOfPlenty extends Artifact {
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains(STORED)){
storedFoodEnergy = bundle.getInt(STORED);
//logic for pre-0.6.1 saves
} else {
//keep partial levels
storedFoodEnergy = (int)(level()%3 * Hunger.HUNGRY/3);
level(level()/3);
}
storedFoodEnergy = bundle.getInt(STORED);
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;

View File

@ -300,8 +300,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION );
//saves from before 0.6.0b are not supported
if (version < ShatteredPixelDungeon.v0_6_0b){
//saves from before 0.6.2e are not supported
if (version < ShatteredPixelDungeon.v0_6_2e){
throw new RuntimeException("old save");
}
@ -324,11 +324,6 @@ public abstract class Level implements Bundlable {
exit = bundle.getInt( EXIT );
locked = bundle.getBoolean( LOCKED );
// pre-0.6.1 saves
if (version <= ShatteredPixelDungeon.v0_6_0b){
map = Terrain.convertTilesFrom0_6_0b( map );
}
Collection<Bundlable> collection = bundle.getCollection( HEAPS );
for (Bundlable h : collection) {