#include "locationcontroller.h" #include "location.h" #include "policy.h" #include "actor.h" LocationController::LocationController(Initializer &&initializer) : Controller(std::move(initializer)) {} LocationController::~LocationController() {} std::string LocationController::interact(std::shared_ptr actor) { std::string interaction_output; const auto validation_result = validatePolicies(); interaction_output += validation_result.validation_output; if (validation_result.success) { actor->moveToLocation(_location); const std::string& node_interact_message = _location->interact(); interaction_output += (_interaction_message + "\n\n" + node_interact_message); } return interaction_output; } void LocationController::setDependentLocation(const std::shared_ptr &location) { _location = location; }