From ca3e80a5b474d99391c253d3173117e955e33a20 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 1 Nov 2024 18:31:16 +0100 Subject: improve error message consistency --- frontend/cmd/go.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'frontend/cmd/go.cpp') 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 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()); + } } -- cgit v1.2.3