aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd/view.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 16:03:53 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 16:03:53 +0100
commita7e84b60366c78b131d43157980fbe4c2df655e6 (patch)
tree391099bfd358e04c8ef38f33311f92b2cd607afe /frontend/cmd/view.cpp
parent798948dbe6f012e194f053c4e862cf697f30b793 (diff)
small cleanup + checks
Diffstat (limited to 'frontend/cmd/view.cpp')
-rw-r--r--frontend/cmd/view.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/frontend/cmd/view.cpp b/frontend/cmd/view.cpp
index 69eb96e..04ad6aa 100644
--- a/frontend/cmd/view.cpp
+++ b/frontend/cmd/view.cpp
@@ -33,7 +33,7 @@ FollowupAction GameController::cmd_view(string & target) {
lprtf("Je hebt %u goundstuk%s.\n", this->player.gold, this->player.gold == 1 ? "" : "ken");
size_t items = this->player.inventory.size();
- lprtf("Je hebt %d overige object%s%s\n", items, items == 1 ? "" : "en", items > 0 ? ":" : ".");
+ lprtf("Je hebt %d %s%s\n", items, items == 1 ? "overig object" : "overige objecten", items > 0 ? ":" : ".");
for (auto & object : this->player.inventory) {
lprtf("- %s\n", object->get_displayname().c_str());
}
@@ -64,9 +64,16 @@ FollowupAction GameController::cmd_view(string & target) {
lprtf("%s\n", enemy->get_description().c_str());
unsigned enemy_health = enemy->get_health();
lprtf("%s heeft %s levenspunten.\n", enemy->get_name().c_str(), enemy_health);
- // IF enemy_health == 0:
- // TODO: show enemy hidden objects
- // TODO: move enemy hidden objects to location visible objects
+
+ if (!enemy->is_dead()) return FollowupAction::NONE;
+ bool snatched = false;
+ for (Object * object : enemy->get_hidden_objects()) {
+ if (!snatched) lprtf("%s had de volgende voorwerpen:\n", enemy->get_displayname().c_str());
+ lprtf("- %s\n", object->get_displayname().c_str());
+ enemy->remove_hidden_object(object);
+ location.add_visible_object(object);
+ snatched = true;
+ }
return FollowupAction::NONE;
}