Fixed parsing Scenery
This commit is contained in:
@@ -31,7 +31,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Room();
|
Room();
|
||||||
Room(int id, std::string name, std::string desc, std::vector<Exit> e, std::vector<Scenery> s);
|
Room(int i, std::string n, std::string desc, std::vector<Exit> e, std::vector<Scenery> s);
|
||||||
Room(const Room &r);
|
Room(const Room &r);
|
||||||
|
|
||||||
void PrintAvalibleExits();
|
void PrintAvalibleExits();
|
||||||
|
|||||||
+7
-6
@@ -10,12 +10,12 @@ Room::Room() {
|
|||||||
exits.clear();
|
exits.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Room::Room(int id, std::string n, std::string desc, std::vector<Exit> e, std::vector<Scenery> s) {
|
Room::Room(int i, std::string n, std::string desc, std::vector<Exit> e, std::vector<Scenery> s) {
|
||||||
id = id;
|
id = i;
|
||||||
name = n;
|
name = std::move(n);
|
||||||
description = desc;
|
description = std::move(desc);
|
||||||
exits = e;
|
exits = std::move(e);
|
||||||
scenery = s;
|
scenery = std::move(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
Room::Room(const Room &r) {
|
Room::Room(const Room &r) {
|
||||||
@@ -23,6 +23,7 @@ Room::Room(const Room &r) {
|
|||||||
name = r.name;
|
name = r.name;
|
||||||
description = r.description;
|
description = r.description;
|
||||||
exits = r.exits;
|
exits = r.exits;
|
||||||
|
scenery = r.scenery;
|
||||||
}
|
}
|
||||||
|
|
||||||
Room::~Room() {
|
Room::~Room() {
|
||||||
|
|||||||
+77
-15
@@ -1,39 +1,101 @@
|
|||||||
[
|
[
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"description": "A fascinating Room. There's ... nothing in it, neat.",
|
"description": "First Test Room",
|
||||||
"exits": [
|
"exits": [
|
||||||
|
{
|
||||||
|
"dir": 1,
|
||||||
|
"exitID": 0,
|
||||||
|
"isLocked": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"dir": 2,
|
"dir": 2,
|
||||||
"exitID": 1,
|
"exitID": 1,
|
||||||
"isLocked": false
|
"isLocked": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": 0,
|
||||||
|
"name": "Test Room 1",
|
||||||
|
"scenery": [
|
||||||
|
{
|
||||||
|
"canTake": false,
|
||||||
|
"description": "A Grey Rock",
|
||||||
|
"id": 0,
|
||||||
|
"keywords": [
|
||||||
|
"Rock"
|
||||||
|
],
|
||||||
|
"name": "Rock",
|
||||||
|
"roomIdItBelongsTo": 0,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A court yard",
|
||||||
|
"exits": [
|
||||||
|
{
|
||||||
|
"dir": 3,
|
||||||
|
"exitID": 2,
|
||||||
|
"isLocked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dir": 2,
|
||||||
|
"exitID": 3,
|
||||||
|
"isLocked": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dir": 1,
|
"dir": 1,
|
||||||
"exitID": 2,
|
"exitID": 4,
|
||||||
"isLocked": false
|
"isLocked": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"id": 1,
|
||||||
|
"name": "Test Room 2",
|
||||||
"scenery": [
|
"scenery": [
|
||||||
{
|
{
|
||||||
}
|
"canTake": false,
|
||||||
|
"description": "A fine looking Tree stands in the courtyard",
|
||||||
|
"id": 1,
|
||||||
|
"keywords": [
|
||||||
|
"Tree"
|
||||||
],
|
],
|
||||||
"id": -8528,
|
"name": "Tree",
|
||||||
"name": "Test Room 1"
|
"roomIdItBelongsTo": 1,
|
||||||
},
|
"type": 1
|
||||||
{
|
}
|
||||||
"description": "Another test room. What a shocker",
|
]
|
||||||
"exits": [],
|
|
||||||
"id": -8608,
|
|
||||||
"name": "Test Room 2"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"description": "Testing another column",
|
"description": "You can hear the sound of a waterfall nearby",
|
||||||
"exits": [],
|
"exits": [
|
||||||
"id": -8656,
|
{
|
||||||
"name": "Test Room 3"
|
"dir": 0,
|
||||||
|
"exitID": 5,
|
||||||
|
"isLocked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dir": 2,
|
||||||
|
"exitID": 6,
|
||||||
|
"isLocked": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": 3,
|
||||||
|
"name": "Test Room 3",
|
||||||
|
"scenery": [
|
||||||
|
{
|
||||||
|
"canTake": false,
|
||||||
|
"description": "A fine waterfall on a cliff",
|
||||||
|
"id": 3,
|
||||||
|
"keywords": [
|
||||||
|
"Waterfall"
|
||||||
|
],
|
||||||
|
"name": "Waterfall",
|
||||||
|
"roomIdItBelongsTo": 3,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
void EditRooms() {
|
||||||
Game game; // Calls default constructor which Initializes GAME
|
|
||||||
|
|
||||||
fs::path path("Resources/rooms.json");
|
fs::path path("Resources/rooms.json");
|
||||||
|
|
||||||
std::vector<std::vector<Room>> rooms = {
|
std::vector<std::vector<Room>> roomDat = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
0,
|
0,
|
||||||
"Test Room 1",
|
"Test Room 1",
|
||||||
"First Test Room",
|
"First Test Room",
|
||||||
{{0, S, false}, {1, E, false}},
|
{{0, S, false}, {1, E, false}},
|
||||||
{{0, "Rock", "A Grey Rock", {"Rock"}, ObjectType::SCENERY, false, 0}},
|
{
|
||||||
|
{0, "Rock", "A Grey Rock", {"Rock"}, ObjectType::SCENERY, false, 0},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{1,
|
{1,
|
||||||
"Test Room 2",
|
"Test Room 2",
|
||||||
@@ -33,19 +35,25 @@ int main(int argc, char *argv[]) {
|
|||||||
{{5, N, false}, {6, E, false}},
|
{{5, N, false}, {6, E, false}},
|
||||||
{{3, "Waterfall", "A fine waterfall on a cliff", {"Waterfall"}, ObjectType::SCENERY, false, 3}}}}};
|
{{3, "Waterfall", "A fine waterfall on a cliff", {"Waterfall"}, ObjectType::SCENERY, false, 3}}}}};
|
||||||
|
|
||||||
nlohmann::json j(rooms);
|
nlohmann::json j(roomDat);
|
||||||
|
|
||||||
std::fstream outFile(absolute(path), std::fstream::in | std::fstream::out | std::fstream::app);
|
std::fstream outFile(absolute(path), std::fstream::in | std::fstream::out | std::fstream::app);
|
||||||
outFile << std::setw(4) << j << std::endl;
|
outFile << std::setw(4) << j << std::endl;
|
||||||
|
|
||||||
outFile.close();
|
outFile.close();
|
||||||
/*if (!game) {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
Game game; // Calls default constructor which Initializes GAME
|
||||||
|
|
||||||
|
if (!game) {
|
||||||
game.Init();
|
game.Init();
|
||||||
Game::SetGameInstance(&game);
|
Game::SetGameInstance(&game);
|
||||||
}
|
}
|
||||||
while (game.GetIsActive()) {
|
while (game.GetIsActive()) {
|
||||||
game.Run();
|
game.Run();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user