aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd/query.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/cmd/query.cpp')
-rw-r--r--frontend/cmd/query.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp
index 19f2584..f04e053 100644
--- a/frontend/cmd/query.cpp
+++ b/frontend/cmd/query.cpp
@@ -3,7 +3,7 @@
#include "backend/Enemy.h"
#include "backend/print.h"
-#include "../Player.h"
+#include "../GameController.h"
using namespace std;
@@ -14,14 +14,15 @@ static const unordered_map<Direction, string> direction_map = {
{ Direction::WEST, "West" },
};
-FollowupAction Player::cmd_query(string &) {
- lprtf("Je staat bij de locatie %s.\n", this->location.get_name().c_str());
- lprtf("%s\n", this->location.get_description().c_str());
+FollowupAction GameController::cmd_query(string &) {
+ Location & location = this->player.get_location();
+ lprtf("Je staat bij de locatie %s.\n", location.get_name().c_str());
+ lprtf("%s\n", location.get_description().c_str());
{
lprtf("Zichtbare objecten: ");
size_t objects = 0;
- for (Object * obj : this->location.get_visible_objects()) {
+ for (Object * obj : location.get_visible_objects()) {
if (objects > 0) lprtf(", ");
lprtf("%s", obj->get_displayname().c_str());
objects++;
@@ -35,7 +36,7 @@ FollowupAction Player::cmd_query(string &) {
lprtf("Uitgangen: ");
bool first = true;
for (Direction direction : DIRECTIONS) {
- if (this->location.get_exit(direction) == nullptr) continue;
+ if (location.get_exit(direction) == nullptr) continue;
if (!first) lprtf(", ");
lprtf("%s", direction_map.at(direction).c_str());
first = false;
@@ -46,7 +47,7 @@ FollowupAction Player::cmd_query(string &) {
{
lprtf("Vijanden: ");
size_t enemies = 0;
- for (Enemy * enemy : this->location.get_enemies()) {
+ for (Enemy * enemy : location.get_enemies()) {
if (enemies > 0) lprtf(", ");
lprtf("%s", enemy->get_name().c_str());
enemies++;