gamePhase() prevent null direction
This commit is contained in:
parent
b1a4f3b3db
commit
826f67d125
|
@ -222,10 +222,9 @@ public class Game implements GameSpecification {
|
|||
direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove();
|
||||
if (direction == null) {
|
||||
track.getCar(currentCarIndex).setMoveStrategy(new DoNotMoveStrategy());
|
||||
track.getCar(currentCarIndex).getMoveStrategy().nextMove();
|
||||
}else {
|
||||
doCarTurn(direction);
|
||||
direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove();
|
||||
}
|
||||
doCarTurn(direction);
|
||||
switchToNextActiveCar();
|
||||
}
|
||||
userInterface.printTrack(track);
|
||||
|
|
Loading…
Reference in New Issue