Bugfix: also save maps that use non-default values

* For example, maps that have had some spawn area deactivated should be saved in the savegame.
This commit is contained in:
Oskar Wiksten
2013-10-27 14:09:45 +01:00
parent 88f15b9099
commit 4209f91d00
2 changed files with 15 additions and 14 deletions

View File

@@ -84,7 +84,7 @@ public final class MapCollection {
private static boolean shouldSaveMap(WorldContext world, PredefinedMap map) {
if (map.visited) return true;
if (map == world.model.currentMap) return true;
if (map.shouldSaveMapData(world)) return true;
return false;
}

View File

@@ -181,19 +181,6 @@ public final class PredefinedMap {
public boolean hasResetTemporaryData() {
return lastVisitTime == VISIT_RESET;
}
private boolean shouldSaveMapData(WorldContext world) {
if (!hasResetTemporaryData()) return true;
if (this == world.model.currentMap) return true;
if (!groundBags.isEmpty()) return true;
for (MonsterSpawnArea a : spawnAreas) {
if (a.isUnique) return true;
if (a.isActive != a.isActiveForNewGame) return true;
}
for (MapObject o : eventObjects) {
if (o.isActive != o.isActiveForNewGame) return true;
}
return false;
}
public void createAllContainerLoot() {
for (MapObject o : eventObjects) {
@@ -267,6 +254,20 @@ public final class PredefinedMap {
}
}
public boolean shouldSaveMapData(WorldContext world) {
if (!hasResetTemporaryData()) return true;
if (this == world.model.currentMap) return true;
if (!groundBags.isEmpty()) return true;
for (MonsterSpawnArea a : spawnAreas) {
if (this.visited && a.isUnique) return true;
if (a.isActive != a.isActiveForNewGame) return true;
}
for (MapObject o : eventObjects) {
if (o.isActive != o.isActiveForNewGame) return true;
}
return false;
}
public void writeToParcel(DataOutputStream dest, WorldContext world, int flags) throws IOException {
if (shouldSaveMapData(world)) {
dest.writeBoolean(true);