Wip: working on add scenery

This commit is contained in:
Timothy O'Barr
2026-09-01 16:27:01 -05:00
parent 15f0e369b2
commit 668d416256
7 changed files with 138 additions and 71 deletions
+18 -7
View File
@@ -24,15 +24,26 @@ protected:
int roomIdItBelongsTo;
public:
Object() = default;
Object(const int i, std::string n, std::string desc, std::vector<std::string> k, const ObjectType o, const bool ct,
const int rID) {
id = i;
name = std::move(n);
description = std::move(desc);
keywords = std::move(k);
type = o;
canTake = ct;
roomIdItBelongsTo = rID;
}
virtual void Interact() = 0;
std::string const GetName() { return name; }
std::string const GetDescription() { return description; }
std::string GetName() const { return name; }
std::string GetDescription() const { return description; }
ObjectType const GetObjectType() { return type; }
std::vector<std::string> const GetKeywords() { return keywords; }
int GetId() { return id; }
int GetRoomId() { return roomIdItBelongsTo; }
bool CanTake() { return canTake; }
ObjectType GetObjectType() const { return type; }
std::vector<std::string> GetKeywords() const { return keywords; }
int GetId() const { return id; }
int GetRoomId() const { return roomIdItBelongsTo; }
bool CanTake() const { return canTake; }
virtual ~Object() = default;
};
+3 -2
View File
@@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "json.hpp"
#include "object.h"
#include "scenery.h"
using json = nlohmann::json;
@@ -27,10 +27,11 @@ private:
std::string name;
std::string description;
std::vector<Exit> exits;
std::vector<Scenery> scenery;
public:
Room();
Room(int id, std::string name, std::string desc, std::vector<Exit> e);
Room(int id, std::string name, std::string desc, std::vector<Exit> e, std::vector<Scenery> s);
Room(const Room &r);
void PrintAvalibleExits();
+11 -10
View File
@@ -1,16 +1,17 @@
#pragma once
#include <iostream>
#include <iomanip>
#include <iostream>
#include "object.h"
class Scenery : Object
{
private:
bool containsItem;
public:
Scenery();
void Examine();
void Interact();
~Scenery();
class Scenery : public Object {
public:
Scenery();
Scenery(int i, std::string n, std::string desc, std::vector<std::string> k, ObjectType t, bool cT, int rID);
void Examine();
void Interact() override;
friend void from_json(const nlohmann::json &j, Scenery &s);
friend void to_json(json &j, const Scenery &s);
};