Fix colorNext
This commit is contained in:
@@ -60,16 +60,14 @@ public Color next(Game game) {
|
|||||||
colorsInGame.add(p.getColor());
|
colorsInGame.add(p.getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
int current = -1;
|
int current = game.getActiveColor().ordinal();
|
||||||
for(int i = 0; i < colorsInGame.size(); i++) {
|
|
||||||
Color c = colorsInGame.get(i);
|
|
||||||
|
|
||||||
if(c.equals(game.getActiveColor())) {
|
int next = current + 1;
|
||||||
current = i;
|
while (!colorsInGame.contains(Color.values()[next])) {
|
||||||
}
|
next++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return colorsInGame.get((current + 1) % colorsInGame.size());
|
return Color.values()[next];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user