Move list feature #26

Merged
fassband merged 4 commits from MoveListFeature into Game 2022-03-18 20:54:27 +01:00
1 changed files with 25 additions and 22 deletions
Showing only changes of commit 837297cd31 - Show all commits

View File

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