diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-14 17:18:13 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-14 17:18:13 +0200 |
commit | 79767f762e39eac3a0247b9ee75b24258790e0de (patch) | |
tree | bb5cb2b84faf91934528fb5b893df804e0a459e0 /src/jrummikub/control/network | |
parent | ebacf1ae7494abc3a80cf1ec242a6202d6438323 (diff) | |
download | JRummikub-79767f762e39eac3a0247b9ee75b24258790e0de.tar JRummikub-79767f762e39eac3a0247b9ee75b24258790e0de.zip |
Show Human/Network type correctly on game join
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@435 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/network')
-rw-r--r-- | src/jrummikub/control/network/GameJoinControl.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/jrummikub/control/network/GameJoinControl.java b/src/jrummikub/control/network/GameJoinControl.java index c436887..048491a 100644 --- a/src/jrummikub/control/network/GameJoinControl.java +++ b/src/jrummikub/control/network/GameJoinControl.java @@ -3,6 +3,9 @@ package jrummikub.control.network; import java.util.ArrayList; import java.util.List; +import jrummikub.model.GameSettings; +import jrummikub.model.PlayerSettings; +import jrummikub.model.PlayerSettings.Type; import jrummikub.util.Connection; import jrummikub.util.GameData; import jrummikub.util.IListener1; @@ -30,13 +33,28 @@ public class GameJoinControl { @Override public void handle(GameData data) { if (data.getGameID().equals(gameData.getGameID())) { - gameData.setGameSettings(data.getGameSettings()); - view.getSettingsPanel().setGameSettings(data.getGameSettings()); + GameSettings settings = data.getGameSettings(); + + fixGameSettings(settings); + + gameData.setGameSettings(settings); + view.getSettingsPanel().setGameSettings(settings); } } })); } + private void fixGameSettings(GameSettings settings) { + for (PlayerSettings player : settings.getPlayerList()) { + if (player.getType() == Type.HUMAN) { + player.setType(Type.NETWORK); + } else if (player.getType() == Type.NETWORK + && player.getName().equals(connectionControl.getNickname())) { + player.setType(Type.HUMAN); + } + } + } + public void startGameJoin() { view.showSettingsPanel(true); } |