#pragma once #include "List.h" #include "ListIterator.h" #include "backend/String.h" class Enemy; class Object; 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() const; void add_hidden_object(Object *); void remove_hidden_object(Object *); ListRange get_hidden_objects() const; void hide_object(Object *); void unhide_object(Object *); void add_enemy(Enemy *); void remove_enemy(Enemy *); ListRange get_enemies() const; private: friend class LocationFactory; Location(const String & name, const String & description); public: virtual ~Location(); private: String name; String description; List enemies; List hidden_objects; List visible_objects; Location * edges[4] = { nullptr, nullptr, nullptr, nullptr, }; };