Files
Text-Adventure/Engine/headers/room.h
T

41 lines
809 B
C++
Raw Normal View History

2026-08-07 13:10:07 -05:00
#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;
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);
};