From d9a0b0e37dbdde6d60fa4ee41c2a100547e7824b Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 24 May 2011 01:51:53 +0200 Subject: Implemented special case round end (heap empty) git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@262 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/model/MockRoundState.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'mock/jrummikub') diff --git a/mock/jrummikub/model/MockRoundState.java b/mock/jrummikub/model/MockRoundState.java index 5f478fb..32fce33 100644 --- a/mock/jrummikub/model/MockRoundState.java +++ b/mock/jrummikub/model/MockRoundState.java @@ -20,7 +20,9 @@ public class MockRoundState implements IRoundState { public StoneHeap gameHeap; /** */ public GameSettings gameSettings; - + /** */ + public IPlayer lastPlayer; + /** */ public MockRoundState() { table = new MockTable(); @@ -63,7 +65,11 @@ public class MockRoundState implements IRoundState { @Override public IPlayer getNthNextPlayer(int i) { - return players.get((activePlayer + i) % players.size()); + int j = (activePlayer + i) % players.size(); + if (j < 0) { + j += players.size(); + } + return players.get(j); } @Override @@ -75,4 +81,14 @@ public class MockRoundState implements IRoundState { public GameSettings getGameSettings() { return gameSettings; } + + @Override + public IPlayer getLastPlayer() { + return lastPlayer; + } + + @Override + public void setLastPlayer(IPlayer lastPlayer) { + this.lastPlayer = lastPlayer; + } } -- cgit v1.2.3