v1.2.0: remains logic now writes an empty bones file instead of deleting

This commit is contained in:
Evan Debenham 2022-03-21 17:59:49 -04:00
parent 879917f601
commit 397d9af143

View File

@ -130,7 +130,9 @@ public class Bones {
Bundle bundle = FileUtils.bundleFromFile(BONES_FILE); Bundle bundle = FileUtils.bundleFromFile(BONES_FILE);
depth = bundle.getInt( LEVEL ); depth = bundle.getInt( LEVEL );
item = (Item)bundle.get( ITEM ); if (depth > 0) {
item = (Item) bundle.get(ITEM);
}
return get(); return get();
@ -141,7 +143,13 @@ public class Bones {
} else { } else {
//heroes who are challenged cannot find bones //heroes who are challenged cannot find bones
if (depth == Dungeon.depth && Dungeon.challenges == 0) { if (depth == Dungeon.depth && Dungeon.challenges == 0) {
FileUtils.deleteFile( BONES_FILE ); Bundle emptyBones = new Bundle();
emptyBones.put(LEVEL, 0);
try {
FileUtils.bundleToFile( BONES_FILE, emptyBones );
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
depth = 0; depth = 0;
if (item == null) return null; if (item == null) return null;