42 lines
859 B
C++
42 lines
859 B
C++
#pragma once
|
|
#include <iostream>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "json.hpp"
|
|
#include "object.h"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
enum Direction { N, S, E, W };
|
|
|
|
struct Exit {
|
|
int exitID;
|
|
Direction dir;
|
|
bool isLocked;
|
|
friend void from_json(const json &j, Exit &e);
|
|
friend void to_json(json &j, const Exit &e);
|
|
};
|
|
|
|
class Room {
|
|
private:
|
|
int id;
|
|
std::string name;
|
|
std::string description;
|
|
std::vector<Exit> exits;
|
|
std::vector<std::unique_ptr<Object>> objects;
|
|
|
|
public:
|
|
Room();
|
|
Room(int id, std::string name, std::string desc, std::vector<Exit> e);
|
|
Room(const Room &r);
|
|
|
|
int AvalibleExits() { return exits.size(); }
|
|
void Print() const;
|
|
|
|
~Room();
|
|
|
|
friend void to_json(nlohmann::json &j, const Room &r);
|
|
friend void from_json(const nlohmann::json &j, Room &r);
|
|
};
|