diff options
Diffstat (limited to 'frontend/cmd/go.cpp')
-rw-r--r-- | frontend/cmd/go.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp index cbe8e7c..624bf6c 100644 --- a/frontend/cmd/go.cpp +++ b/frontend/cmd/go.cpp @@ -2,6 +2,7 @@ #include "../Player.h" #include "../print.h" +#include "../strings.h" using namespace std; @@ -12,13 +13,14 @@ static const unordered_map<string, Direction> direction_map = { { "west", Direction::WEST }, }; -FollowupAction Player::cmd_go(Argv argv) { - if (argv.size() == 0 || !direction_map.contains(argv[0])) { +FollowupAction Player::cmd_go(string & argv) { + string direction_str = str_consume_arg(argv); + if (direction_str.size() == 0 || !direction_map.contains(direction_str)) { lprtf("Fout, gebruik: Ga <noord|zuid|oost|west>\n"); return FollowupAction::NONE; } - Direction direction = direction_map.at(argv[0]); + Direction direction = direction_map.at(direction_str); Location * next_location = this->location.get_exit(direction); if (next_location == nullptr) { lprtf("Er is geen uitgang in deze richting!\n"); |