aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/cmd')
-rw-r--r--frontend/cmd/cheat.cpp2
-rw-r--r--frontend/cmd/go.cpp6
-rw-r--r--frontend/cmd/query.cpp2
3 files changed, 4 insertions, 6 deletions
diff --git a/frontend/cmd/cheat.cpp b/frontend/cmd/cheat.cpp
index 981bca1..59fb13c 100644
--- a/frontend/cmd/cheat.cpp
+++ b/frontend/cmd/cheat.cpp
@@ -12,7 +12,7 @@ constexpr const char * cmd_give_key = "Manifesteer";
void GameController::cmd_give(string & item_name) {
Player & player = this->dungeon->get_player();
GameData & gamedata = GameData::get_instance();
- auto object = unique_ptr<Object>(gamedata.create_object(item_name));
+ auto object = gamedata.create_object(item_name);
lprtf("Object aangemaakt: %s\n", object->get_displayname().c_str());
player.inventory.push_back(object.release());
}
diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp
index 6fb9105..0452897 100644
--- a/frontend/cmd/go.cpp
+++ b/frontend/cmd/go.cpp
@@ -22,13 +22,11 @@ void GameController::cmd_go(string & direction_str) {
Player & player = this->dungeon->get_player();
Direction direction = direction_map.at(direction_str);
- Location * next_location = player.get_location().get_exit(direction);
- if (next_location == nullptr)
- throw Exception("er is geen uitgang in deze richting");
+ Location & next_location = player.get_location().get_exit(direction);
this->dungeon->update();
if (!player.is_dead())
- player.set_location(*next_location);
+ player.set_location(next_location);
}
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp
index 6de7f56..66f1bb2 100644
--- a/frontend/cmd/query.cpp
+++ b/frontend/cmd/query.cpp
@@ -39,7 +39,7 @@ void GameController::cmd_query(string &) {
lprtf("Uitgangen: ");
bool first = true;
for (Direction direction : DIRECTIONS) {
- if (location.get_exit(direction) == nullptr) continue;
+ if (!location.has_exit(direction)) continue;
if (!first) lprtf(", ");
lprtf("%s", direction_map.at(direction).c_str());
first = false;