38 lines
941 B
C++
38 lines
941 B
C++
#include "location.h"
|
|
#include <algorithm>
|
|
|
|
Location::Location(Initializer &&initializer) :
|
|
_interaction_message(initializer.message),
|
|
_interactive_controllers(initializer.interactive_controllers)
|
|
{}
|
|
|
|
const std::string& Location::interact()
|
|
{
|
|
return _interaction_message;
|
|
}
|
|
|
|
const std::list<std::shared_ptr<Controller>>& Location::controllers()
|
|
{
|
|
return _interactive_controllers;
|
|
}
|
|
|
|
void Location::removeControllers(const std::list<std::shared_ptr<Controller>> &controllers)
|
|
{
|
|
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;
|
|
}
|