private static void onWorldLoaded(WorldContext world) {
ActorStatsController.recalculatePlayerCombatTraits(world.model.player);
- Controller.resetMaps(world, true, true);
+ Controller.resetMapsNotRecentlyVisited(world);
MovementController.moveBlockedActors(world);
}
@Override
public void onClick(View arg0) {
for(PredefinedMap map : world.maps.predefinedMaps) {
- map.lastVisitTime = 1;
- map.resetIfNotRecentlyVisited(true);
+ map.resetTemporaryData();
}
mainActivity.showToast("DEBUG: maps respawned", Toast.LENGTH_SHORT);
}
player.spawnPlace = area.id;
player.spawnMap = world.model.currentMap.name;
}
- resetMaps(world, false, true);
+ for (PredefinedMap m : world.maps.predefinedMaps) {
+ m.resetTemporaryData();
+ }
if (area != null) {
world.model.currentMap.spawnAll(world);
}
return false;
}
- public static void resetMaps(final WorldContext world, boolean excludeCurrentMap, boolean resetEvenIfMapIsAlreadyReset) {
+ public static void resetMapsNotRecentlyVisited(final WorldContext world) {
for (PredefinedMap m : world.maps.predefinedMaps) {
- if (excludeCurrentMap) {
- if (m == world.model.currentMap) continue;
- }
- m.resetIfNotRecentlyVisited(resetEvenIfMapIsAlreadyReset);
+ if (m == world.model.currentMap) continue;
+ if (m.isRecentlyVisited()) continue;
+ if (m.hasResetTemporaryData()) continue;
+ m.resetTemporaryData();
}
}
model.uiSelections.isMainActivityVisible = false;
}
- private void onNewFullRound() {
- Controller.resetMaps(world, true, false);
- view.actorStatsController.applyConditionsToMonsters(model.currentMap, true);
+ public void onNewFullRound() {
+ Controller.resetMapsNotRecentlyVisited(world);
+ view.actorStatsController.applyConditionsToMonsters(model.currentMap, true);
view.actorStatsController.applyConditionsToPlayer(model.player, true);
}
}
private static void playerVisitsMapFirstTime(final WorldContext world, PredefinedMap m) {
+ m.reset();
m.spawnAll(world);
m.createAllContainerLoot();
m.visited = true;
groundBags.remove(loot);
}
public void reset() {
- groundBags.clear();
+ resetTemporaryData();
for(MonsterSpawnArea a : spawnAreas) {
a.reset();
}
- splatters.clear();
+ groundBags.clear();
visited = false;
- lastVisitTime = VISIT_RESET;
}
public boolean isRecentlyVisited() {
public void updateLastVisitTime() {
lastVisitTime = System.currentTimeMillis();
}
- public void resetIfNotRecentlyVisited(boolean resetEvenIfMapIsAlreadyReset) {
- if (!resetEvenIfMapIsAlreadyReset) {
- if (lastVisitTime == VISIT_RESET) return;
- }
- if (isRecentlyVisited()) return;
-
- // We reset all non-unique spawn areas. This keeps the savegame file smaller, thus reducing load and save times. Also keeps the running memory usage slightly lower.
+ public void resetTemporaryData() {
for(MonsterSpawnArea a : spawnAreas) {
if (a.isUnique) a.resetShops();
else a.reset();
splatters.clear();
lastVisitTime = VISIT_RESET;
}
+ public boolean hasResetTemporaryData() {
+ return lastVisitTime == VISIT_RESET;
+ }
public void createAllContainerLoot() {
for (MapObject o : eventObjects) {