code cleanup
This commit is contained in:
parent
c41b56b47e
commit
be2fb1fb5c
|
@ -6,6 +6,7 @@ import ch.zhaw.pm2.racetrack.strategy.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
|
import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
|
||||||
|
@ -34,9 +35,7 @@ public class Game implements GameSpecification {
|
||||||
*/
|
*/
|
||||||
public boolean initPhase() {
|
public boolean initPhase() {
|
||||||
if (config.getTrackDirectory().listFiles().length > 0) {
|
if (config.getTrackDirectory().listFiles().length > 0) {
|
||||||
List<String> tracks = new ArrayList<>();
|
File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", Arrays.asList(config.getTrackDirectory().list()))];
|
||||||
|
|
||||||
File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", tracks)];
|
|
||||||
try {
|
try {
|
||||||
selectTrack(selectedTrack);
|
selectTrack(selectedTrack);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|
Loading…
Reference in New Issue