diff --git a/.idea/editor.xml b/.idea/editor.xml
index 7bb5dec..451df98 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -26,26 +26,27 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -191,6 +192,7 @@
+
@@ -224,9 +226,11 @@
+
+
diff --git a/Engine/headers/room.h b/Engine/headers/room.h
index 6477495..0948380 100644
--- a/Engine/headers/room.h
+++ b/Engine/headers/room.h
@@ -24,7 +24,6 @@ private:
std::string name;
std::string description;
std::vector exits;
- std::vector> objects;
public:
Room();
diff --git a/Engine/src/game.cpp b/Engine/src/game.cpp
index a01835d..14a8a41 100644
--- a/Engine/src/game.cpp
+++ b/Engine/src/game.cpp
@@ -20,14 +20,7 @@ bool Game::Init() {
stream.open(absolute(filePath));
json = nlohmann::json::parse(stream);
- // rooms = json.get>>();
- auto &roomData = json["rooms"];
- for (const auto &roomCol: rooms) {
- for (const auto &roomRow: roomCol) {
- // rooms.push_back(roomRow.get());
- }
- }
-
+ rooms = json.get>>();
player.Init();
parser = CommandParser();
diff --git a/Engine/src/room.cpp b/Engine/src/room.cpp
index 5c9ec6a..983cd0b 100644
--- a/Engine/src/room.cpp
+++ b/Engine/src/room.cpp
@@ -34,18 +34,16 @@ void Room::Print() const {
}
-inline void from_json(const json &j, Exit &e) {
+void from_json(const json &j, Exit &e) {
j.at("exitID").get_to(e.exitID);
j.at("dir").get_to(e.dir);
j.at("isLocked").get_to(e.isLocked);
}
-inline void to_json(json &j, const Exit &e) {
- j = json{{"exitID", e.exitID}, {"dir", e.dir}, {"isLocked", e.isLocked}};
-}
+void to_json(json &j, const Exit &e) { j = json{{"exitID", e.exitID}, {"dir", e.dir}, {"isLocked", e.isLocked}}; }
-inline void from_json(const json &j, Room &r) {
+void from_json(const json &j, Room &r) {
j.at("id").get_to(r.id);
j.at("name").get_to(r.name);
j.at("description").get_to(r.description);
diff --git a/Resources/Rooms.json b/Resources/Rooms.json
index d7fed3f..26979c1 100644
--- a/Resources/Rooms.json
+++ b/Resources/Rooms.json
@@ -1,45 +1,35 @@
-{
- "rooms": [
+[
[
- {
- "id": 0,
- "name": "Test Room 1",
- "description": "A fascinating Room. There's ... nothing in it, neat.",
- "exits": [
- {
- "exitID": 1,
- "dir": "E",
- "isLocked": false
- },
- {
- "exitID": 2,
- "dir": "S",
- "isLocked": false
- }
- ]
- },
- {
- "id": 1,
- "name": "Test Room 2",
- "description": "Another test room. What a shocker",
- "exits": [
- {}
- ]
- }
+ {
+ "description": "A fascinating Room. There's ... nothing in it, neat.",
+ "exits": [
+ {
+ "dir": 2,
+ "exitID": 1,
+ "isLocked": false
+ },
+ {
+ "dir": 1,
+ "exitID": 2,
+ "isLocked": false
+ }
+ ],
+ "id": -8528,
+ "name": "Test Room 1"
+ },
+ {
+ "description": "Another test room. What a shocker",
+ "exits": [],
+ "id": -8608,
+ "name": "Test Room 2"
+ }
],
[
- {
- "id": 6,
- "name": "Test Room 3",
- "description": "Testing another column",
- "exits": [
- {
- "exitID": 0,
- "dir": "S",
- "isLocked": false
- }
- ]
- }
+ {
+ "description": "Testing another column",
+ "exits": [],
+ "id": -8656,
+ "name": "Test Room 3"
+ }
]
- ]
-}
\ No newline at end of file
+]
diff --git a/main.cpp b/main.cpp
index 628e70b..5f5cbff 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,14 +1,14 @@
+#include
+#include
#include
#include "game.h"
int main(int argc, char *argv[]) {
- Game game;
+ Game game; // Calls default constructor which Initalizes GAME
- if (game.Init()) {
- while (game.GetIsActive()) {
- game.Run();
- }
+ while (game.GetIsActive()) {
+ game.Run();
}
return 0;