aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/GameController.cpp2
-rw-r--r--frontend/cmd/equip.cpp4
-rw-r--r--frontend/cmd/get.cpp2
-rw-r--r--frontend/cmd/go.cpp14
-rw-r--r--frontend/cmd/hit.cpp2
-rw-r--r--frontend/cmd/put.cpp2
-rw-r--r--frontend/cmd/view.cpp2
7 files changed, 16 insertions, 12 deletions
diff --git a/frontend/GameController.cpp b/frontend/GameController.cpp
index f160006..d7b5f96 100644
--- a/frontend/GameController.cpp
+++ b/frontend/GameController.cpp
@@ -85,7 +85,7 @@ void GameController::gameloop() {
try {
this->cmd(line);
} catch (Exception & e) {
- lprtf("FOUT: %s\n", e.what());
+ lprtf("FOUT: %s.\n", e.what());
}
if (player.is_dead())
diff --git a/frontend/cmd/equip.cpp b/frontend/cmd/equip.cpp
index 238d287..9d2a006 100644
--- a/frontend/cmd/equip.cpp
+++ b/frontend/cmd/equip.cpp
@@ -28,8 +28,8 @@ void GameController::cmd_equip(string & target_name) {
return;
}
- throw Exception("Object \"%s\" is niet draagbaar.", target_name.c_str());
+ throw Exception("object \"%s\" is niet draagbaar", target_name.c_str());
}
- throw Exception("Object \"%s\" niet gevonden.", target_name.c_str());
+ throw Exception("object \"%s\" niet gevonden", target_name.c_str());
}
diff --git a/frontend/cmd/get.cpp b/frontend/cmd/get.cpp
index dd098d1..3e85e57 100644
--- a/frontend/cmd/get.cpp
+++ b/frontend/cmd/get.cpp
@@ -23,7 +23,7 @@ void GameController::cmd_get(string & target_name) {
break;
}
if (target == nullptr)
- throw Exception("Object \"%s\" niet gevonden.", target_name.c_str());
+ throw Exception("object \"%s\" niet gevonden", target_name.c_str());
// gold objects are collected and (implicitly) destroyed
GoldObject * gold = dynamic_cast<GoldObject *>(target.get());
diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp
index 185d727..75f6345 100644
--- a/frontend/cmd/go.cpp
+++ b/frontend/cmd/go.cpp
@@ -1,7 +1,7 @@
#include "backend/Location.h"
-#include "backend/print.h"
#include "backend/Dungeon.h"
#include "backend/Exception.h"
+#include "backend/print.h"
#include "../GameController.h"
#include "../strings.h"
@@ -18,17 +18,21 @@ static const unordered_map<string, Direction> direction_map = {
void GameController::cmd_go(string & argv) {
string direction_str = str_consume_arg(argv);
if (direction_str.size() == 0)
- throw Exception("Dit commando heeft nog een argument met een richting nodig");
+ throw Exception("dit commando heeft nog een argument met een richting nodig");
if (!direction_map.contains(direction_str))
- throw Exception("Onbekende richting \"%s\", probeer noord|zuid|oost|west", direction_str.c_str());
+ throw Exception("onbekende richting \"%s\", probeer noord|zuid|oost|west", direction_str.c_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");
+ throw Exception("er is geen uitgang in deze richting");
- player.set_location(*next_location);
this->dungeon->update();
+
+ if (!player.is_dead()) {
+ player.set_location(*next_location);
+ lprtf("Je staat nu bij de locatie %s\n", player.get_location().get_name().c_str());
+ }
}
diff --git a/frontend/cmd/hit.cpp b/frontend/cmd/hit.cpp
index 8491758..8866f60 100644
--- a/frontend/cmd/hit.cpp
+++ b/frontend/cmd/hit.cpp
@@ -28,6 +28,6 @@ void GameController::cmd_hit(string & target_name) {
return;
}
- throw Exception("Vijand \"%s\" niet gevonden.", target_name.c_str());
+ throw Exception("vijand \"%s\" niet gevonden", target_name.c_str());
}
diff --git a/frontend/cmd/put.cpp b/frontend/cmd/put.cpp
index be3bcca..7f54c3b 100644
--- a/frontend/cmd/put.cpp
+++ b/frontend/cmd/put.cpp
@@ -20,6 +20,6 @@ void GameController::cmd_put(string & target_name) {
return;
}
- throw Exception("Object \"%s\" niet gevonden.", target_name.c_str());
+ throw Exception("object \"%s\" niet gevonden", target_name.c_str());
}
diff --git a/frontend/cmd/view.cpp b/frontend/cmd/view.cpp
index bd9e99b..291e321 100644
--- a/frontend/cmd/view.cpp
+++ b/frontend/cmd/view.cpp
@@ -81,6 +81,6 @@ void GameController::cmd_view(string & target) {
return;
}
- throw Exception("geen entiteit met naam \"%s\" gevonden.", target.c_str());
+ throw Exception("geen entiteit met naam \"%s\" gevonden", target.c_str());
}