aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd/go.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 10:18:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 10:18:22 +0100
commit798948dbe6f012e194f053c4e862cf697f30b793 (patch)
tree32c71420d1188f98cfb41b6f0d9536c5fa4bf5a7 /frontend/cmd/go.cpp
parentd7012045bb61f117fb7b9c51ddd03e4c54f25fe6 (diff)
more WIP (move some Player things to backend)
Diffstat (limited to 'frontend/cmd/go.cpp')
-rw-r--r--frontend/cmd/go.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp
index 9565e99..6a5f3b2 100644
--- a/frontend/cmd/go.cpp
+++ b/frontend/cmd/go.cpp
@@ -1,7 +1,7 @@
#include "backend/Location.h"
#include "backend/print.h"
-#include "../Player.h"
+#include "../GameController.h"
#include "../strings.h"
using namespace std;
@@ -13,7 +13,7 @@ static const unordered_map<string, Direction> direction_map = {
{ "west", Direction::WEST },
};
-FollowupAction Player::cmd_go(string & argv) {
+FollowupAction GameController::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");
@@ -21,13 +21,13 @@ FollowupAction Player::cmd_go(string & argv) {
}
Direction direction = direction_map.at(direction_str);
- Location * next_location = this->location.get_exit(direction);
+ Location * next_location = this->player.get_location().get_exit(direction);
if (next_location == nullptr) {
lprtf("Er is geen uitgang in deze richting!\n");
return FollowupAction::NONE;
}
- this->location = *next_location;
+ this->player.set_location(*next_location);
return FollowupAction::UPDATE;
}