From 798948dbe6f012e194f053c4e862cf697f30b793 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 1 Nov 2024 10:18:22 +0100 Subject: more WIP (move some Player things to backend) --- frontend/cmd/go.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'frontend/cmd/go.cpp') 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 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 \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; } -- cgit v1.2.3