diff --git a/EU3_Scenario_Editor/src/editor/mapmode/ReligionMode.java b/EU3_Scenario_Editor/src/editor/mapmode/ReligionMode.java index 94069ea..10a8c60 100644 --- a/EU3_Scenario_Editor/src/editor/mapmode/ReligionMode.java +++ b/EU3_Scenario_Editor/src/editor/mapmode/ReligionMode.java @@ -22,9 +22,7 @@ */ public final class ReligionMode extends ProvincePaintingMode { - private String lastDate = null; - private final java.util.Map ctryReligions = - new HashMap(); + private final java.util.Map ctryReligions = new HashMap<>(); /** * Creates a new instance of ReligionMode. @@ -39,8 +37,6 @@ public ReligionMode(MapPanel panel) { @Override protected void paintingStarted(final Graphics2D g) { final MapPanelDataModel model = mapPanel.getModel(); - if (lastDate != null && lastDate.equals(model.getDate())) - return; ctryReligions.clear(); @@ -48,36 +44,34 @@ protected void paintingStarted(final Graphics2D g) { for (String tag : tags) { ctryReligions.put(tag.toUpperCase(), model.getHistString(tag, "religion")); } - - lastDate = model.getDate(); } protected void paintProvince(final Graphics2D g, int provId) { + if (getMap().isWasteland(provId)) { + mapPanel.paintProvince(g, provId, java.awt.Color.BLACK); + return; + } + final String religion = mapPanel.getModel().getHistString(provId, "religion"); - if (getMap().isWasteland(provId)) - mapPanel.paintProvince(g, provId, java.awt.Color.BLACK); - else if (religion == null) { + if (religion == null) { mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST); } else if (religion.length() == 0 || religion.equalsIgnoreCase("none")) { mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_RELIGION); } else { final String owner = mapPanel.getModel().getOwner(provId).toUpperCase(); - //final String ownerRel = (Utilities.isNotACountry(owner) ? null : mapPanel.getModel().getHistString(owner, "religion")); final String ownerRel = ctryReligions.get(owner); if (ownerRel == null || religion.equalsIgnoreCase(ownerRel)) { mapPanel.paintProvince(g, provId, Utilities.getReligionColor(religion)); } else { final Paint p = Utilities.createPaint(Utilities.getReligionColor(religion), Utilities.getReligionColor(ownerRel)); -// if (p != null) - mapPanel.paintProvince(g, provId, p); -// else -// System.err.println("Unknown problem in ReligionMode.java"); + mapPanel.paintProvince(g, provId, p); } } } + @Override protected void paintSeaZone(final Graphics2D g, int id) { // do nothing } @@ -97,7 +91,7 @@ public String getTooltipExtraText(final Province current) { String ctryRel = null; if (owner != null) { - if (Utilities.isNotACountry(owner) /*noCountryPattern.matcher(owner).matches()*/) { + if (Utilities.isNotACountry(owner)) { // don't add anything owner = "-"; } else {