aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-02-23 22:44:26 +0100
committerPacien TRAN-GIRARD2014-02-23 22:47:32 +0100
commit5f1d0ada248764beda05dee2695bab802eeadcd6 (patch)
treea200e0ab08f4d85a80bc287b2cbcddcec7fdea00
parent5de55c8b8417b22a72ff0c59687a7c0c2eaf8a6e (diff)
downloadesieequest-5f1d0ada248764beda05dee2695bab802eeadcd6.tar.gz
Change command list printing
-rw-r--r--src/esieequest/CommandWords.java7
-rw-r--r--src/esieequest/Game.java2
-rw-r--r--src/esieequest/Parser.java4
3 files changed, 7 insertions, 6 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java
index a0718e3..c942043 100644
--- a/src/esieequest/CommandWords.java
+++ b/src/esieequest/CommandWords.java
@@ -35,10 +35,11 @@ public class CommandWords {
35 /** 35 /**
36 * Print all valid commands to System.out. 36 * Print all valid commands to System.out.
37 */ 37 */
38 public void showAll() { 38 public String getCommandList() {
39 String vCommands = "";
39 for (String vCommand : this.sValidCommands) { 40 for (String vCommand : this.sValidCommands) {
40 System.out.print(vCommand + " "); 41 vCommands += " " + vCommand;
41 } 42 }
42 System.out.println(); 43 return vCommands;
43 } 44 }
44} 45}
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java
index 165724a..cae7559 100644
--- a/src/esieequest/Game.java
+++ b/src/esieequest/Game.java
@@ -215,7 +215,7 @@ public class Game {
215 System.out.println("You wander around at the university."); 215 System.out.println("You wander around at the university.");
216 System.out.println(""); 216 System.out.println("");
217 System.out.println("Your command words are:"); 217 System.out.println("Your command words are:");
218 this.aParser.showCommands(); 218 System.out.println(this.aParser.showCommands());
219 } 219 }
220 220
221 private void look() { 221 private void look() {
diff --git a/src/esieequest/Parser.java b/src/esieequest/Parser.java
index b8f5c94..d270f1e 100644
--- a/src/esieequest/Parser.java
+++ b/src/esieequest/Parser.java
@@ -59,7 +59,7 @@ public class Parser {
59 /** 59 /**
60 * Print out a list of valid command words. 60 * Print out a list of valid command words.
61 */ 61 */
62 public void showCommands() { 62 public String showCommands() {
63 this.aValidCommands.showAll(); 63 return this.aValidCommands.getCommandList();
64 } 64 }
65} 65}