Game #23
|
@ -47,6 +47,7 @@ public class Game implements GameSpecification {
|
||||||
moveStrategies.add("Move List Strategy");
|
moveStrategies.add("Move List Strategy");
|
||||||
moveStrategies.add("Path Follow Move Strategy");
|
moveStrategies.add("Path Follow Move Strategy");
|
||||||
for (int i = 0; i < track.getCarCount(); i++) {
|
for (int i = 0; i < track.getCarCount(); i++) {
|
||||||
|
while(track.getCar(i).getMoveStrategy() == null) {
|
||||||
int moveStrategie = userInterface.selectOption(
|
int moveStrategie = userInterface.selectOption(
|
||||||
"Select Strategy for Car " + i + " (" + track.getCarId(i) + ")", moveStrategies);
|
"Select Strategy for Car " + i + " (" + track.getCarId(i) + ")", moveStrategies);
|
||||||
switch (moveStrategie + 1) {
|
switch (moveStrategie + 1) {
|
||||||
|
@ -57,12 +58,13 @@ public class Game implements GameSpecification {
|
||||||
track.getCar(i).setMoveStrategy(new UserMoveStrategy(userInterface, i, track.getCarId(i)));
|
track.getCar(i).setMoveStrategy(new UserMoveStrategy(userInterface, i, track.getCarId(i)));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
String path = ".\\moves\\ " + selectedTrack.getName().split("\\.")[0] + "-car-" + track.getCar(i).getID() + ".txt";
|
String path = ".\\moves\\" + selectedTrack.getName().split("\\.")[0] + "-car-" + track.getCar(i).getID() + ".txt";
|
||||||
|
System.out.println(path);
|
||||||
try {
|
try {
|
||||||
MoveStrategy moveStrategy = new MoveListStrategy(path);
|
MoveStrategy moveStrategy = new MoveListStrategy(path);
|
||||||
track.getCar(i).setMoveStrategy(moveStrategy);
|
track.getCar(i).setMoveStrategy(moveStrategy);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
//TODO: what if not valid
|
userInterface.printInformation("There is no MoveList implemented. Choose another Strategy!");
|
||||||
}
|
}
|
||||||
//TODO: Backslash kompatibel für Linux
|
//TODO: Backslash kompatibel für Linux
|
||||||
break;
|
break;
|
||||||
|
@ -71,6 +73,7 @@ public class Game implements GameSpecification {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
userInterface.printInformation("No Trackfile found!");
|
userInterface.printInformation("No Trackfile found!");
|
||||||
|
|
Loading…
Reference in New Issue