aboutsummaryrefslogtreecommitdiff
path: root/backend/Location.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 20:31:18 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 20:31:18 +0100
commitd8daa3e045ca2f41edcbed533bc5a9fef1363a17 (patch)
tree6a4c0883d05607476b609e68bcac7d854e281aea /backend/Location.cpp
parent6e1d62955c7a7f39bc9126d709a42a70e02a1d30 (diff)
print to backend
Diffstat (limited to 'backend/Location.cpp')
-rw-r--r--backend/Location.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/backend/Location.cpp b/backend/Location.cpp
index d3227cf..7246246 100644
--- a/backend/Location.cpp
+++ b/backend/Location.cpp
@@ -22,7 +22,8 @@ Location::Location(const String & name, const String & description) : name(name)
Location::~Location() {
safe_free(this->enemies);
- safe_free(this->objects);
+ safe_free(this->hidden_objects);
+ safe_free(this->visible_objects);
}
void Location::set_name(const String & name) { this->name = name; }
@@ -38,14 +39,33 @@ Location * Location::get_exit(Direction dir) const {
return this->edges[dir];
}
-void Location::add_object(Object * object) {
- this->objects.push_back(object);
+void Location::add_visible_object(Object * object) {
+ this->visible_objects.push_back(object);
}
-void Location::remove_object(Object * object) {
- this->objects.remove(object);
+void Location::remove_visible_object(Object * object) {
+ this->visible_objects.remove(object);
}
-ListRange<Object *> Location::get_objects() const {
- return this->objects.range();
+ListRange<Object *> Location::get_visible_objects() const {
+ return this->visible_objects.range();
+}
+
+void Location::add_hidden_object(Object * object) {
+ this->hidden_objects.push_back(object);
+}
+void Location::remove_hidden_object(Object * object) {
+ this->hidden_objects.remove(object);
+}
+ListRange<Object *> Location::get_hidden_objects() const {
+ return this->hidden_objects.range();
+}
+
+void Location::hide_object(Object * object) {
+ this->visible_objects.remove(object);
+ this->hidden_objects.push_back(object);
+}
+void Location::unhide_object(Object * object) {
+ this->hidden_objects.remove(object);
+ this->visible_objects.push_back(object);
}
void Location::add_enemy(Enemy * enemy) {