Fix colorNext

This commit is contained in:
Felix Koppe
2024-12-08 19:46:09 +01:00
parent 5dc3124533
commit b61b8214fe

View File

@@ -60,16 +60,14 @@ public Color next(Game game) {
colorsInGame.add(p.getColor());
}
int current = -1;
for(int i = 0; i < colorsInGame.size(); i++) {
Color c = colorsInGame.get(i);
int current = game.getActiveColor().ordinal();
if(c.equals(game.getActiveColor())) {
current = i;
}
int next = current + 1;
while (!colorsInGame.contains(Color.values()[next])) {
next++;
}
return colorsInGame.get((current + 1) % colorsInGame.size());
return Color.values()[next];
}
/**