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