From 68cc2402b4064485d0fad67fd281d4f5a341fe16 Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Thu, 2 Dec 2021 15:28:00 +0100 Subject: [PATCH] Added player switches --- src/ch/zhaw/catan/SiedlerGame.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 4ce4675..4ab205d 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -59,6 +59,12 @@ public class SiedlerGame { */ public void switchToNextPlayer() { // TODO: Implement + if (activePlayer < allPlayers.size()){ + activePlayer++; + } + else if (activePlayer == allPlayers.size()){ + activePlayer = 0; + } } /** @@ -66,6 +72,12 @@ public class SiedlerGame { */ public void switchToPreviousPlayer() { // TODO: Implement + if (activePlayer > 0){ + activePlayer--; + } + else if (activePlayer == 0){ + activePlayer = allPlayers.size()-1; + } } /**