From 63ffedd7b0ecfbf690551b0e2fefac3058ff08c2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 5 May 2011 16:56:35 +0200 Subject: Add name to player model git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@145 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/model/MockGameState.java | 8 ++++---- mock/jrummikub/model/MockPlayer.java | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'mock') diff --git a/mock/jrummikub/model/MockGameState.java b/mock/jrummikub/model/MockGameState.java index 102e9fb..1d4a7a2 100644 --- a/mock/jrummikub/model/MockGameState.java +++ b/mock/jrummikub/model/MockGameState.java @@ -13,10 +13,10 @@ public class MockGameState implements IGameState { public MockGameState() { table = new MockTable(); players = new ArrayList(); - players.add(new MockPlayer(Color.red)); - players.add(new MockPlayer(Color.yellow)); - players.add(new MockPlayer(Color.green)); - players.add(new MockPlayer(Color.black)); + players.add(new MockPlayer("Player 1", Color.RED)); + players.add(new MockPlayer("Player 2", Color.YELLOW)); + players.add(new MockPlayer("Player 3", Color.GREEN)); + players.add(new MockPlayer("Player 4", Color.BLACK)); activePlayer = 0; gameHeap = new StoneHeap(); } diff --git a/mock/jrummikub/model/MockPlayer.java b/mock/jrummikub/model/MockPlayer.java index adb9d85..2f573ca 100644 --- a/mock/jrummikub/model/MockPlayer.java +++ b/mock/jrummikub/model/MockPlayer.java @@ -5,12 +5,14 @@ import java.awt.Color; public class MockPlayer implements IPlayer { public MockHand hand; + public String name; public Color color; // private String name; - public MockPlayer(Color color) { + public MockPlayer(String name, Color color) { hand = new MockHand(); + this.name = name; this.color = color; } @@ -23,4 +25,9 @@ public class MockPlayer implements IPlayer { public Color getColor() { return color; } + + @Override + public String getName() { + return name; + } } -- cgit v1.2.3