Skip to content

Commit

Permalink
fix arrows drawing out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
kevlahnota committed Nov 16, 2024
1 parent 95e3304 commit 5597d0b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions forge-gui-mobile/src/forge/screens/match/MatchScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,22 +466,35 @@ void drawArcs(Graphics g) {
final GameView game = MatchController.instance.getGameView();
try {
for (PlayerView p : game.getPlayers()) {
if (p != null && playerPanelsList.contains(getPlayerPanel(p))) {
if (p == null)
continue;
VPlayerPanel playerPanel = getPlayerPanel(p);
if (playerPanel != null && playerPanelsList.contains(playerPanel)) {
playerViewSet.add(p);
if (p.getBattlefield() != null) {
for (CardView c : p.getBattlefield()) {
endpoints.put(c.getId(), CardAreaPanel.get(c).getTargetingArrowOrigin());
CardAreaPanel panel = CardAreaPanel.get(c);
Vector2 origin = panel.getTargetingArrowOrigin();
//outside left bounds
if (origin.x < playerPanel.getField().getLeft())
continue;
//outside right bounds
if (origin.x > playerPanel.getField().getRight())
continue;
endpoints.put(c.getId(), origin);
cardsonBattlefield.add(c);
}
}
}
}
if (endpoints.isEmpty())
return;
//draw arrows for combat
final CombatView combat = game.getCombat();
for (CardView c : cardsonBattlefield) {
TargetingOverlay.assembleArrows(g, c, endpoints, combat, playerViewSet);
}
} catch (Exception e) {
} catch (Exception ignored) {
}
}

Expand Down

0 comments on commit 5597d0b

Please sign in to comment.