Skip to content

Commit

Permalink
Merge pull request #2653 from aRTy42/develop
Browse files Browse the repository at this point in the history
get/setMapVisible: return BigDecimal instead of String 0/1
  • Loading branch information
Phergus authored May 15, 2021
2 parents da4c630 + cd54953 commit 7664101
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.google.gson.JsonArray;
import com.google.gson.JsonPrimitive;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import net.rptools.maptool.client.MapTool;
Expand Down Expand Up @@ -72,14 +73,16 @@ public Object childEvaluate(
FunctionUtil.checkNumberParam(functionName, parameters, 0, 1);
if (parameters.size() > 0) {
String mapName = parameters.get(0).toString();
return getNamedMap(functionName, mapName).getZone().isVisible() ? "1" : "0";
return getNamedMap(functionName, mapName).getZone().isVisible()
? BigDecimal.ONE
: BigDecimal.ZERO;
} else {
// Return the visibility of the current map/zone
ZoneRenderer currentZR = MapTool.getFrame().getCurrentZoneRenderer();
if (currentZR == null) {
throw new ParserException(I18N.getText("macro.function.map.none", functionName));
} else {
return currentZR.getZone().isVisible() ? "1" : "0";
return currentZR.getZone().isVisible() ? BigDecimal.ONE : BigDecimal.ZERO;
}
}
} else if ("setMapVisible".equalsIgnoreCase(functionName)) {
Expand All @@ -103,7 +106,7 @@ public Object childEvaluate(
MapTool.serverCommand().setZoneVisibility(zone.getId(), zone.isVisible());
MapTool.getFrame().getZoneMiniMapPanel().flush();
MapTool.getFrame().repaint();
return zone.isVisible() ? "1" : "0";
return zone.isVisible() ? BigDecimal.ONE : BigDecimal.ZERO;

} else if ("setMapName".equalsIgnoreCase(functionName)) {
checkTrusted(functionName);
Expand Down

0 comments on commit 7664101

Please sign in to comment.