2021-05-08 03:36:26 +02:00
|
|
|
#include "locationrequiredpolicy.h"
|
|
|
|
#include "location.h"
|
2021-05-16 01:44:19 +02:00
|
|
|
#include "actor.h"
|
2021-05-08 03:36:26 +02:00
|
|
|
|
|
|
|
LocationRequiredPolicy::LocationRequiredPolicy(const std::string& satisfaction, const std::string& dissatisfaction) :
|
|
|
|
Policy(satisfaction, dissatisfaction)
|
|
|
|
{}
|
|
|
|
|
|
|
|
LocationRequiredPolicy::~LocationRequiredPolicy()
|
|
|
|
{}
|
|
|
|
|
2021-05-16 01:44:19 +02:00
|
|
|
Policy::CheckResult LocationRequiredPolicy::check(const std::shared_ptr<Actor>& actor) const
|
2021-05-08 03:36:26 +02:00
|
|
|
{
|
2021-05-16 01:44:19 +02:00
|
|
|
bool success = actor->isLocationVisited(_location);
|
2021-05-08 03:36:26 +02:00
|
|
|
return composeMessageFromResult(success);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationRequiredPolicy::setRequiredLocation(const std::shared_ptr<Location> &location)
|
|
|
|
{
|
|
|
|
_location = location;
|
|
|
|
}
|