From e8e5ac2ca76a9e363b1da7d326b9b9aea6eeb4ec Mon Sep 17 00:00:00 2001 From: drdev Date: Fri, 29 Nov 2013 02:51:55 +0000 Subject: [PATCH] Don't show command zone if game type doesn't need it --- forge-gui/src/main/java/forge/game/Game.java | 15 +++++++++++ .../main/java/forge/gui/match/VMatchUI.java | 25 +++++++++++++------ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/forge-gui/src/main/java/forge/game/Game.java b/forge-gui/src/main/java/forge/game/Game.java index 5d661df2008..e3ff5774642 100644 --- a/forge-gui/src/main/java/forge/game/Game.java +++ b/forge-gui/src/main/java/forge/game/Game.java @@ -512,6 +512,21 @@ public class Game { public GameType getType() { return type; } + + /** + * @return whether command zone is needed for this game + */ + @SuppressWarnings("incomplete-switch") + public boolean isCommandZoneNeeded() { + switch (type) { + case Archenemy: + case Commander: + case Planechase: + case Vanguard: + return true; + } + return false; + } /** * @return the activePlane diff --git a/forge-gui/src/main/java/forge/gui/match/VMatchUI.java b/forge-gui/src/main/java/forge/gui/match/VMatchUI.java index a024f93f2c5..30b42f76920 100644 --- a/forge-gui/src/main/java/forge/gui/match/VMatchUI.java +++ b/forge-gui/src/main/java/forge/gui/match/VMatchUI.java @@ -94,13 +94,24 @@ public enum VMatchUI implements IVTopLevelUI { } } - // Add extra players alternatively to existing user/AI field panels. - for (int i = 2; i < lstCommands.size(); i++) { - // If already in layout, no need to add again. - VCommand cmdView = lstCommands.get(i); - if (cmdView.getParentCell() == null) { - lstCommands.get(i % 2).getParentCell().addDoc(cmdView); - } + if (Singletons.getControl().getObservedGame().isCommandZoneNeeded()) { + // Add extra players alternatively to existing user/AI field panels. + for (int i = 2; i < lstCommands.size(); i++) { + // If already in layout, no need to add again. + VCommand cmdView = lstCommands.get(i); + if (cmdView.getParentCell() == null) { + lstCommands.get(i % 2).getParentCell().addDoc(cmdView); + } + } + } + else { + //If game goesn't need command zone, remove it from existing field panels + for (int i = 0; i < 2; i++) { + VCommand cmdView = lstCommands.get(i); + if (cmdView.getParentCell() != null) { + cmdView.getParentCell().removeDoc(cmdView); + } + } } // Add extra hands to existing hand panel.