slumber-quest/entities/location.cpp

38 lines
941 B
C++
Raw Normal View History

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