#include "backend/Location.h" #include "backend/Object.h" #include "backend/Enemy.h" #include "../Player.h" #include "../print.h" using namespace std; static const unordered_map direction_map = { { Direction::NORTH, "Noord" }, { Direction::EAST, "Oost" }, { Direction::SOUTH, "Zuid" }, { Direction::WEST, "West" }, }; FollowupAction Player::cmd_query(string &) { lprtf("Je staat bij de locatie %s.\n", this->location.get_name()); lprtf("%s\n", this->location.get_description()); { lprtf("Zichtbare objecten: "); size_t objects = 0; for (Object * obj : this->location.get_objects()) { if (obj->get_hidden() == true) continue; if (objects > 0) lprtf(", "); lprtf("%s", obj->get_displayname()); objects++; } if (objects == 0) lprtf("(geen)"); lprtf("\n"); } { lprtf("Uitgangen: "); bool first = true; for (Direction direction : DIRECTIONS) { if (this->location.get_exit(direction) == nullptr) continue; if (!first) lprtf(", "); lprtf("%s", direction_map.at(direction).c_str()); first = false; } lprtf("\n"); } { lprtf("Vijanden: "); size_t enemies = 0; for (Enemy * enemy : this->location.get_enemies()) { if (enemies > 0) lprtf(", "); lprtf("%s", enemy->get_name()); enemies++; } if (enemies == 0) lprtf("(geen)"); lprtf("\n"); } return FollowupAction::NONE; }