fixes in Game.java Method switchToNextActiveCar

This commit is contained in:
romanschenk37 2022-03-18 10:55:31 +01:00
parent e1e03d4ad4
commit 74a83e790a
1 changed files with 4 additions and 1 deletions

View File

@ -197,9 +197,12 @@ public class Game implements GameSpecification {
@Override
public void switchToNextActiveCar() {
do {
if (currentCarIndex++ > track.getCarCount()) {
if ((currentCarIndex + 1) == track.getCarCount()) {
currentCarIndex = 0;
}
else {
currentCarIndex ++;
}
} while (track.getCar(currentCarIndex).isCrashed());
// TODO: evtl andere Kapselung
}