slumber-quest/policies/locationrequiredpolicy.cpp

22 lines
618 B
C++

#include "locationrequiredpolicy.h"
#include "location.h"
#include "actor.h"
LocationRequiredPolicy::LocationRequiredPolicy(const std::string& satisfaction, const std::string& dissatisfaction) :
Policy(satisfaction, dissatisfaction)
{}
LocationRequiredPolicy::~LocationRequiredPolicy()
{}
Policy::CheckResult LocationRequiredPolicy::check(const std::shared_ptr<Actor>& actor) const
{
bool success = actor->isLocationVisited(_location);
return composeMessageFromResult(success);
}
void LocationRequiredPolicy::setRequiredLocation(const std::shared_ptr<Location> &location)
{
_location = location;
}