aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
commit5c34847218e8d754447f5cf71ed595bbb412eee7 (patch)
tree2872948e6d2f566dd66cb1a9b2a5d9900db4c44f /frontend/cmd
parenta04cb74fee079e3ee43ae5fae32fc2674409822c (diff)
more WIP
Diffstat (limited to 'frontend/cmd')
-rw-r--r--frontend/cmd/query.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp
index 367d6cd..3a26e9c 100644
--- a/frontend/cmd/query.cpp
+++ b/frontend/cmd/query.cpp
@@ -1,4 +1,5 @@
#include "backend/Location.h"
+#include "backend/Object.h"
#include "../Player.h"
#include "../print.h"
@@ -16,17 +17,31 @@ FollowupAction Player::cmd_query(Argv argv) {
lprtf("Je staat bij de locatie %s.\n", this->location.get_name());
lprtf("%s\n", this->location.get_description());
- // TODO: visible objects
+ {
+ 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("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("\n");
// TODO: enemies