2021-05-08 03:36:26 +02:00
|
|
|
#include "location.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
Location::Location(Initializer &&initializer) :
|
|
|
|
_interaction_message(initializer.message),
|
2021-05-16 01:44:19 +02:00
|
|
|
_interactive_controllers(initializer.interactive_controllers)
|
2021-05-08 03:36:26 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
const std::string& Location::interact()
|
|
|
|
{
|
|
|
|
return _interaction_message;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::list<std::shared_ptr<Controller>>& Location::controllers()
|
|
|
|
{
|
|
|
|
return _interactive_controllers;
|
|
|
|
}
|
|
|
|
|
2021-05-16 01:44:19 +02:00
|
|
|
void Location::removeControllers(const std::list<std::shared_ptr<Controller>> &controllers)
|
2021-05-08 03:36:26 +02:00
|
|
|
{
|
2021-05-16 01:44:19 +02: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-08 03:36:26 +02:00
|
|
|
}
|