2021-05-07 21:36:26 -04:00
|
|
|
#include "location.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
Location::Location(Initializer &&initializer) :
|
|
|
|
_interaction_message(initializer.message),
|
2021-05-15 19:44:19 -04:00
|
|
|
_interactive_controllers(initializer.interactive_controllers)
|
2021-05-07 21:36:26 -04:00
|
|
|
{}
|
|
|
|
|
|
|
|
const std::string& Location::interact()
|
|
|
|
{
|
|
|
|
return _interaction_message;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::list<std::shared_ptr<Controller>>& Location::controllers()
|
|
|
|
{
|
|
|
|
return _interactive_controllers;
|
|
|
|
}
|
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
void Location::removeControllers(const std::list<std::shared_ptr<Controller>> &controllers)
|
2021-05-07 21:36:26 -04:00
|
|
|
{
|
2021-05-15 19:44:19 -04:00
|
|
|
for (const auto& to_remove_controller : controllers)
|
|
|
|
{
|
|
|
|
for (auto it = _interactive_controllers.begin(); it != _interactive_controllers.end(); ++it)
|
|
|
|
{
|
|
|
|
if ((*it) == to_remove_controller)
|
|
|
|
{
|
|
|
|
_interactive_controllers.erase(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Location::setInteractionMessage(const std::string& message)
|
|
|
|
{
|
|
|
|
_interaction_message = message;
|
2021-05-07 21:36:26 -04:00
|
|
|
}
|