Merge pull request #968 from Allofich/AIActivate

Use namespace block in aiactivate
This commit is contained in:
scrawl 2016-06-17 17:41:10 +02:00 committed by GitHub
commit 17a54b2a97

View file

@ -12,15 +12,19 @@
#include "steering.hpp" #include "steering.hpp"
#include "movement.hpp" #include "movement.hpp"
MWMechanics::AiActivate::AiActivate(const std::string &objectId) namespace MWMechanics
{
AiActivate::AiActivate(const std::string &objectId)
: mObjectId(objectId) : mObjectId(objectId)
{ {
} }
MWMechanics::AiActivate *MWMechanics::AiActivate::clone() const
AiActivate *MWMechanics::AiActivate::clone() const
{ {
return new AiActivate(*this); return new AiActivate(*this);
} }
bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
bool AiActivate::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{ {
ESM::Position pos = actor.getRefData().getPosition(); //position of the actor ESM::Position pos = actor.getRefData().getPosition(); //position of the actor
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow
@ -51,12 +55,12 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor, CharacterContr
return false; return false;
} }
int MWMechanics::AiActivate::getTypeId() const int AiActivate::getTypeId() const
{ {
return TypeIdActivate; return TypeIdActivate;
} }
void MWMechanics::AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const void AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate()); std::auto_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate());
activate->mTargetId = mObjectId; activate->mTargetId = mObjectId;
@ -67,8 +71,8 @@ void MWMechanics::AiActivate::writeState(ESM::AiSequence::AiSequence &sequence)
sequence.mPackages.push_back(package); sequence.mPackages.push_back(package);
} }
MWMechanics::AiActivate::AiActivate(const ESM::AiSequence::AiActivate *activate) AiActivate::AiActivate(const ESM::AiSequence::AiActivate *activate)
: mObjectId(activate->mTargetId) : mObjectId(activate->mTargetId)
{ {
}
} }