mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-25 04:40:52 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user