From 60edd73fc2593b7a48fd9b1a06cd19e724351c99 Mon Sep 17 00:00:00 2001 From: Zukero Date: Mon, 2 Oct 2017 16:32:31 +0200 Subject: [PATCH] Removed unnecessary warnings about replace area requirement-related properties. Added code to clear the "isApplied" flag on a replace area when another replace area is applied later and intersects with the first one. --- .../com/gpl/rpg/AndorsTrail/controller/MapController.java | 7 +++++++ .../gpl/rpg/AndorsTrail/model/map/TMXMapTranslator.java | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MapController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MapController.java index 2dcf06894..acced11b8 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MapController.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MapController.java @@ -186,6 +186,13 @@ public final class MapController { if (!satisfiesCondition(replacement)) continue; else ConversationController.requirementFulfilled(world, replacement.requirement); tileMap.applyReplacement(replacement); + for (ReplaceableMapSection impactedReplacement : tileMap.replacements) { + if (impactedReplacement.isApplied && impactedReplacement.replacementArea.intersects(replacement.replacementArea)) { + //The applied replacement has overwritten changes made by a previously applied replacement. + //This previous replacement must now be considered as unapplied to let it be reapplied later eventually. + impactedReplacement.isApplied = false; + } + } hasUpdated = true; } } diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/TMXMapTranslator.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/TMXMapTranslator.java index c85491380..aed27b394 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/TMXMapTranslator.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/TMXMapTranslator.java @@ -288,7 +288,8 @@ public final class TMXMapTranslator { else if (prop.name.equalsIgnoreCase(LAYERNAME_ABOVE)) layerNames.aboveLayersName = prop.value; else if (prop.name.equalsIgnoreCase(LAYERNAME_WALKABLE)) layerNames.walkableLayersName = prop.value; else if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) { - L.log("OPTIMIZE: Map " + map.name + " contains replace area with unknown property \"" + prop.name + "\"."); + if (!requirementPropertiesNames.contains(prop.name)) + L.log("OPTIMIZE: Map " + map.name + " contains replace area with unknown property \"" + prop.name + "\"."); } } MapSection replacementSection = transformMapSection(map, tileCache, position, layersPerLayerName, usedTileIDs, layerNames);