Skip to content

Commit

Permalink
Fix NPE in Set Facing tool
Browse files Browse the repository at this point in the history
We now handle the case where a token does not have a facing. In that case, the tool updates the other clients to also
remove the facing.
  • Loading branch information
kwvanderlinde committed Sep 27, 2024
1 parent fbb27b1 commit ae4cce9
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/main/java/net/rptools/maptool/client/tool/FacingTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,6 @@ public void mouseMoved(MouseEvent e) {
}
token.setFacing(degrees);

// Old Logic
// if (renderer.getZone().hasFog()
// && ((AppPreferences.getAutoRevealVisionOnGMMovement() &&
// MapTool.getPlayer().isGM()))
// || MapTool.getServerPolicy().isAutoRevealOnMovement()) {
// visibleArea = renderer.getZoneView().getVisibleArea(token);
// remoteSelected.add(token.getId());
// renderer.getZone().exposeArea(visibleArea, token);
// }
boolean revealFog = false;
if (renderer.getZone().hasFog()) {
if (ownerReveal && token.isOwner(name)) revealFog = true;
Expand Down Expand Up @@ -168,8 +159,14 @@ public void mousePressed(MouseEvent e) {
if (token == null) {
continue;
}
// Send the facing to other players
MapTool.serverCommand().updateTokenProperty(token, Token.Update.setFacing, token.getFacing());

// Send the facing (or lack thereof) to other players
if (!token.hasFacing()) {
MapTool.serverCommand().updateTokenProperty(token, Token.Update.removeFacing);
} else {
MapTool.serverCommand()
.updateTokenProperty(token, Token.Update.setFacing, token.getFacing());
}
}
// Go back to the pointer tool
resetTool();
Expand Down

0 comments on commit ae4cce9

Please sign in to comment.