Skip to content
Snippets Groups Projects
Commit c69a1f63 authored by Gabriel Mille's avatar Gabriel Mille
Browse files

correction input

parent 1f064988
No related branches found
No related tags found
No related merge requests found
________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________
Commandes :
a - Attaquer
q - Quitter
________________________________________________________________________________________________________________________
\ No newline at end of file
...@@ -28,7 +28,7 @@ public class Input { ...@@ -28,7 +28,7 @@ public class Input {
} }
public void newInput(String input) { public void newInput(String input) {
while (!validInput()) { do {
try { try {
setInput(input); setInput(input);
} catch (InvalidInputException e) { } catch (InvalidInputException e) {
...@@ -39,12 +39,16 @@ public class Input { ...@@ -39,12 +39,16 @@ public class Input {
} }
} }
} }
while (!validInput());
} }
public Input() { public Input() {
this.inputRange = new ArrayList<>(); this.inputRange = new ArrayList<>();
this.inputRange.add("q"); //Commande pour quitter this.inputRange.add("q"); //Commande pour quitter
this.inputRange.add("a"); //Commande pour attaquer this.inputRange.add("a"); //Commande pour attaquer
for (Attack a : Attack.values()) this.inputRange.add(a.getName());
for (Defense d : Defense.values()) this.inputRange.add(d.getName());
} }
public boolean validInput() { public boolean validInput() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment