From d8daa3e045ca2f41edcbed533bc5a9fef1363a17 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 30 Oct 2024 20:31:18 +0100 Subject: print to backend --- backend/Location.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'backend/Location.cpp') 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 Location::get_objects() const { - return this->objects.range(); +ListRange 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 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) { -- cgit v1.2.3