#pragma once #include "PtrList.h" #include "ListIterator.h" #include "String.h" #include "Enemy.h" #include "Object.h" class Location; enum Direction { NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3, }; static constexpr const Direction DIRECTIONS[] = { NORTH, EAST, SOUTH, WEST }; Direction random_direction(); Direction random_direction(const Location &); class Location { public: void set_name(const String & name); const String & get_name() const; void set_description(const String & description); const String & get_description() const; void set_exit(Direction dir, Location * location = nullptr); Location * get_exit(Direction dir) const; void add_visible_object(Object *); void remove_visible_object(Object *); ListRange get_visible_objects(); void add_hidden_object(Object *); void remove_hidden_object(Object *); ListRange get_hidden_objects(); void hide_object(Object *); void unhide_object(Object *); void add_enemy(Enemy *); void remove_enemy(Enemy *); ListRange get_enemies(); private: friend class LocationFactory; Location(const String & name, const String & description); public: virtual ~Location() = default; private: String name; String description; PtrList enemies; PtrList hidden_objects; PtrList visible_objects; Location * edges[4] = { nullptr, nullptr, nullptr, nullptr, }; };