aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-05-04 17:37:41 +0200
committerPacien TRAN-GIRARD2014-05-04 17:37:41 +0200
commit688634ae5a5aaf663159032e67d2132ea61c5d5f (patch)
treee0642498c904e8a9373df479239fbfc603a957d3 /src
parent780bae6cd1a4d2a81b8c3ed72ee5d73cee9b5ccb (diff)
downloadesieequest-688634ae5a5aaf663159032e67d2132ea61c5d5f.tar.gz
Implement "save" and "load"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/esieequest/Main.java13
-rw-r--r--src/esieequest/controller/GameEngine.java28
-rw-r--r--src/esieequest/controller/commands/Command.java4
-rw-r--r--src/esieequest/controller/commands/GoCommand.java2
-rw-r--r--src/esieequest/controller/commands/LoadCommand.java29
-rw-r--r--src/esieequest/controller/commands/NewCommand.java8
-rw-r--r--src/esieequest/controller/commands/SaveCommand.java3
-rw-r--r--src/esieequest/controller/commands/TakeCommand.java2
-rw-r--r--src/esieequest/controller/commands/TurnCommand.java2
-rw-r--r--src/esieequest/controller/utils/EnumUtils.java159
-rw-r--r--src/esieequest/controller/utils/ListUtils.java (renamed from src/esieequest/controller/Utils.java)4
-rw-r--r--src/esieequest/controller/utils/SerialisableObject.java26
-rw-r--r--src/esieequest/controller/utils/package-info.java4
-rw-r--r--src/esieequest/esieequest.gwt.xml1
-rw-r--r--src/esieequest/model/Game.java81
-rw-r--r--src/esieequest/model/Player.java77
-rw-r--r--src/esieequest/model/Text.java9
-rw-r--r--src/esieequest/model/characters/Character.java81
-rw-r--r--src/esieequest/model/characters/MovingCharacter.java37
-rw-r--r--src/esieequest/model/characters/SimpleCharacter.java52
-rw-r--r--src/esieequest/model/items/Beamer.java21
-rw-r--r--src/esieequest/model/items/Item.java26
-rw-r--r--src/esieequest/model/items/SimpleItem.java17
-rw-r--r--src/esieequest/model/map/Direction.java1
-rw-r--r--src/esieequest/model/map/Room.java69
-rw-r--r--src/esieequest/model/map/Side.java32
-rw-r--r--src/esieequest/view/app/UserInterface.java1
-rw-r--r--src/esieequest/view/text/TextInterface.java2
-rw-r--r--src/esieequest/view/web/Main.java4
-rw-r--r--src/esieequest/view/web/WebInterface.java3
-rw-r--r--src/esieequest/view/web/WebInterface.ui.xml2
-rw-r--r--src/net/pacien/util/CleanJSONObject.java48
-rw-r--r--src/net/pacien/util/IntrinsicMap.java23
-rw-r--r--src/org/json/simple/ItemList.java158
-rw-r--r--src/org/json/simple/JSONArray.java390
-rw-r--r--src/org/json/simple/JSONAware.java14
-rw-r--r--src/org/json/simple/JSONObject.java143
-rw-r--r--src/org/json/simple/JSONStreamAware.java18
-rw-r--r--src/org/json/simple/JSONValue.java317
-rw-r--r--src/org/json/simple/jsonsimple.gwt.xml4
-rw-r--r--src/org/json/simple/parser/ContainerFactory.java26
-rw-r--r--src/org/json/simple/parser/ContentHandler.java110
-rw-r--r--src/org/json/simple/parser/JSONParser.java544
-rw-r--r--src/org/json/simple/parser/ParseException.java92
-rw-r--r--src/org/json/simple/parser/Yylex.java625
-rw-r--r--src/org/json/simple/parser/Yytoken.java60
-rw-r--r--src/rejava/io/Reader.java20
-rw-r--r--src/rejava/io/StringReader.java51
-rw-r--r--src/rejava/io/StringWriter.java29
-rw-r--r--src/rejava/io/Writer.java16
-rw-r--r--src/rejava/io/package-info.java6
-rw-r--r--src/rejava/io/rejavaio.gwt.xml3
52 files changed, 3396 insertions, 101 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java
index 6e7c0f2..f8b013f 100755
--- a/src/esieequest/Main.java
+++ b/src/esieequest/Main.java
@@ -6,7 +6,6 @@ import java.util.List;
6import javax.swing.JApplet; 6import javax.swing.JApplet;
7 7
8import esieequest.controller.GameEngine; 8import esieequest.controller.GameEngine;
9import esieequest.model.Game;
10import esieequest.view.Viewable; 9import esieequest.view.Viewable;
11import esieequest.view.app.Applet; 10import esieequest.view.app.Applet;
12import esieequest.view.app.Window; 11import esieequest.view.app.Window;
@@ -32,9 +31,8 @@ public class Main extends JApplet {
32 */ 31 */
33 @Override 32 @Override
34 public void init() { 33 public void init() {
35 final Game game = new Game();
36 final Applet applet = new Applet(this); 34 final Applet applet = new Applet(this);
37 new GameEngine(game, applet); 35 new GameEngine(applet);
38 } 36 }
39 37
40 /** 38 /**
@@ -47,7 +45,6 @@ public class Main extends JApplet {
47 */ 45 */
48 public static void main(final String[] args) { 46 public static void main(final String[] args) {
49 final List<String> arguments = Arrays.asList(args); 47 final List<String> arguments = Arrays.asList(args);
50 Game game;
51 Viewable view; 48 Viewable view;
52 49
53 if (arguments.contains("--file")) { 50 if (arguments.contains("--file")) {
@@ -62,13 +59,7 @@ public class Main extends JApplet {
62 view = new Window(); 59 view = new Window();
63 } 60 }
64 61
65 if (arguments.contains("--challenge")) { 62 new GameEngine(view);
66 game = new Game(true);
67 } else {
68 game = new Game();
69 }
70
71 new GameEngine(game, view);
72 } 63 }
73 64
74} 65}
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java
index c3a8725..df83384 100644
--- a/src/esieequest/controller/GameEngine.java
+++ b/src/esieequest/controller/GameEngine.java
@@ -25,7 +25,7 @@ public class GameEngine {
25 * @param view 25 * @param view
26 * the view 26 * the view
27 */ 27 */
28 public GameEngine(final Game game, final Viewable view) { 28 public GameEngine(final Viewable view, final Game game) {
29 this.game = game; 29 this.game = game;
30 this.view = view; 30 this.view = view;
31 31
@@ -35,13 +35,35 @@ public class GameEngine {
35 } 35 }
36 36
37 /** 37 /**
38 * Instantiates a game with the given view and mode.
39 *
40 * @param view
41 * the view
42 * @param challengeMode
43 * the mode
44 */
45 public GameEngine(final Viewable view, final boolean challengeMode) {
46 this(view, new Game(challengeMode));
47 }
48
49 /**
50 * Instantiates a game with the given view.
51 *
52 * @param view
53 * the view
54 */
55 public GameEngine(final Viewable view) {
56 this(view, false);
57 }
58
59 /**
38 * Interprets a command. 60 * Interprets a command.
39 * 61 *
40 * @param commandString 62 * @param commandString
41 * the command String 63 * the command String
42 */ 64 */
43 public void interpret(final String inputString) { 65 public void interpret(final String inputString) {
44 final Input input = new Input(inputString.toLowerCase()); 66 final Input input = new Input(inputString/* .toLowerCase() */);
45 67
46 final Command command = input.getCommand(); 68 final Command command = input.getCommand();
47 if (command == null) { 69 if (command == null) {
@@ -56,7 +78,7 @@ public class GameEngine {
56 } 78 }
57 79
58 /** 80 /**
59 * Actions executed every time a Command is entered. 81 * Performs routine actions executed every time a Command is entered.
60 */ 82 */
61 private void executeRoutines() { 83 private void executeRoutines() {
62 MovingCharacter.moveAll(); 84 MovingCharacter.moveAll();
diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java
index 7ab6961..094b0cf 100644
--- a/src/esieequest/controller/commands/Command.java
+++ b/src/esieequest/controller/commands/Command.java
@@ -3,7 +3,7 @@ package esieequest.controller.commands;
3import java.util.ArrayList; 3import java.util.ArrayList;
4import java.util.List; 4import java.util.List;
5 5
6import esieequest.controller.Utils; 6import esieequest.controller.utils.ListUtils;
7import esieequest.model.Game; 7import esieequest.model.Game;
8import esieequest.model.Text; 8import esieequest.model.Text;
9import esieequest.view.Viewable; 9import esieequest.view.Viewable;
@@ -94,7 +94,7 @@ public enum Command {
94 * @return a String listing all the names of the Command-s 94 * @return a String listing all the names of the Command-s
95 */ 95 */
96 public static String listCommandsNamesString() { 96 public static String listCommandsNamesString() {
97 return Utils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.getText(), null, Text.HELP_SUFFIX.getText()); 97 return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.getText(), null, Text.HELP_SUFFIX.getText());
98 } 98