diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-14 02:43:55 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-14 02:43:55 +0200 |
commit | 4879b7b93eaff1f80056d78e19271d6418ec6534 (patch) | |
tree | afcc617cdefeff9d2fe264d377a4412660b23e3d /src/jrummikub/view | |
parent | f6b1c638a17a9e3c9c1dcbac0fd748a3f13d70f3 (diff) | |
download | JRummikub-4879b7b93eaff1f80056d78e19271d6418ec6534.tar JRummikub-4879b7b93eaff1f80056d78e19271d6418ec6534.zip |
Display open games correctly
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@433 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/impl/GameListPanel.java | 18 | ||||
-rw-r--r-- | src/jrummikub/view/impl/SettingsPanel.java | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/jrummikub/view/impl/GameListPanel.java b/src/jrummikub/view/impl/GameListPanel.java index d22dc02..7324559 100644 --- a/src/jrummikub/view/impl/GameListPanel.java +++ b/src/jrummikub/view/impl/GameListPanel.java @@ -21,6 +21,8 @@ import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; +import jrummikub.model.PlayerSettings; +import jrummikub.model.PlayerSettings.Type; import jrummikub.util.Event; import jrummikub.util.Event1; import jrummikub.util.GameData; @@ -188,13 +190,21 @@ class GameListPanel extends JPanel implements IGameListPanel { int index, boolean isSelected, boolean cellHasFocus) { String host = "", playerCount = ""; - if (value instanceof GameData && ((GameData)value).getGameSettings() != null) { + if (value instanceof GameData + && ((GameData) value).getGameSettings() != null) { GameData gameData = (GameData) value; host = gameData.getHost(); - /*playerCount = gameData.getCurrentPlayerCount() + "/" - + gameData.getMaxPlayerCount();*/ - playerCount = String.valueOf(gameData.getGameSettings().getPlayerList().size()); + int total = gameData.getGameSettings().getPlayerList().size(); + int occupied = total; + + for (PlayerSettings player : gameData.getGameSettings().getPlayerList()) { + if (player.getType() == Type.VACANT) { + occupied--; + } + } + + playerCount = occupied + "/" + total; } else { host = String.valueOf(value); } diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index 60fe20c..8ec9d3e 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -275,6 +275,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { @Override public void enableStartGameButton(boolean enable) { startButton.setEnabled(enable); + offerButton.setEnabled(enable); } @Override @@ -861,6 +862,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { case HUMAN: return "Mensch"; case NETWORK: + case VACANT: return "Netzwerk"; } |