1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Single AI package clone definition

This commit is contained in:
elsid 2020-05-17 22:00:44 +02:00
parent 103188b61d
commit 8e0934cbd8
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
23 changed files with 4 additions and 75 deletions

View file

@ -18,11 +18,6 @@ namespace MWMechanics
{
}
AiActivate *MWMechanics::AiActivate::clone() const
{
return new AiActivate(*this);
}
bool AiActivate::execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow

View file

@ -28,7 +28,6 @@ namespace MWMechanics
AiActivate(const ESM::AiSequence::AiActivate* activate);
AiActivate *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -72,11 +72,6 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor, CharacterCont
return false;
}
MWMechanics::AiAvoidDoor *MWMechanics::AiAvoidDoor::clone() const
{
return new AiAvoidDoor(*this);
}
int MWMechanics::AiAvoidDoor::getTypeId() const
{
return TypeIdAvoidDoor;

View file

@ -22,8 +22,6 @@ namespace MWMechanics
/// Avoid door until the door is fully open
AiAvoidDoor(const MWWorld::ConstPtr& doorPtr);
AiAvoidDoor *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -32,11 +32,6 @@ bool MWMechanics::AiBreathe::execute (const MWWorld::Ptr& actor, CharacterContro
return true;
}
MWMechanics::AiBreathe *MWMechanics::AiBreathe::clone() const
{
return new AiBreathe(*this);
}
int MWMechanics::AiBreathe::getTypeId() const
{
return TypeIdBreathe;

View file

@ -10,8 +10,6 @@ namespace MWMechanics
class AiBreathe final : public TypedAiPackage<AiBreathe>
{
public:
AiBreathe *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -18,11 +18,6 @@ MWMechanics::AiCast::AiCast(const std::string& targetId, const std::string& spel
mDistance = action.getCombatRange(isRanged);
}
MWMechanics::AiPackage *MWMechanics::AiCast::clone() const
{
return new AiCast(*this);
}
bool MWMechanics::AiCast::execute(const MWWorld::Ptr& actor, MWMechanics::CharacterController& characterController, MWMechanics::AiState& state, float duration)
{
MWWorld::Ptr target;

View file

@ -15,8 +15,6 @@ namespace MWMechanics
public:
AiCast(const std::string& targetId, const std::string& spellId, bool manualSpell=false);
AiPackage *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -421,11 +421,6 @@ namespace MWMechanics
return MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId);
}
AiCombat *MWMechanics::AiCombat::clone() const
{
return new AiCombat(*this);
}
void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::unique_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat());

View file

@ -102,8 +102,6 @@ namespace MWMechanics
void init();
AiCombat *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -55,12 +55,6 @@ namespace MWMechanics
mDuration = 0;
}
AiEscort *MWMechanics::AiEscort::clone() const
{
return new AiEscort(*this);
}
bool AiEscort::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
// If AiEscort has ran for as long or longer then the duration specified

View file

@ -30,8 +30,6 @@ namespace MWMechanics
AiEscort(const ESM::AiSequence::AiEscort* escort);
AiEscort *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -9,11 +9,6 @@ MWMechanics::AiFace::AiFace(float targetX, float targetY)
{
}
MWMechanics::AiPackage *MWMechanics::AiFace::clone() const
{
return new AiFace(*this);
}
bool MWMechanics::AiFace::execute(const MWWorld::Ptr& actor, MWMechanics::CharacterController& /*characterController*/, MWMechanics::AiState& /*state*/, float /*duration*/)
{
osg::Vec3f dir = osg::Vec3f(mTargetX, mTargetY, 0) - actor.getRefData().getPosition().asVec3();

View file

@ -10,8 +10,6 @@ namespace MWMechanics
public:
AiFace(float targetX, float targetY);
AiPackage *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -201,11 +201,6 @@ std::string AiFollow::getFollowedActor()
return mTargetActorRefId;
}
AiFollow *MWMechanics::AiFollow::clone() const
{
return new AiFollow(*this);
}
int AiFollow::getTypeId() const
{
return TypeIdFollow;

View file

@ -57,8 +57,6 @@ namespace MWMechanics
bool followTargetThroughDoors() const final { return true; }
bool shouldCancelPreviousAi() const final { return !mCommanded; }
AiFollow *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -27,10 +27,6 @@ AiPursue::AiPursue(const ESM::AiSequence::AiPursue *pursue)
mTargetActorId = pursue->mTargetActorId;
}
AiPursue *MWMechanics::AiPursue::clone() const
{
return new AiPursue(*this);
}
bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
if(actor.getClass().getCreatureStats(actor).isDead())

View file

@ -26,7 +26,6 @@ namespace MWMechanics
AiPursue(const ESM::AiSequence::AiPursue* pursue);
AiPursue *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -36,11 +36,6 @@ namespace MWMechanics
{
}
AiTravel *MWMechanics::AiTravel::clone() const
{
return new AiTravel(*this);
}
bool AiTravel::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
auto& stats = actor.getClass().getCreatureStats(actor);

View file

@ -26,8 +26,6 @@ namespace MWMechanics
void writeState(ESM::AiSequence::AiSequence &sequence) const final;
AiTravel *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -115,11 +115,6 @@ namespace MWMechanics
mDuration = 0;
}
AiPackage * MWMechanics::AiWander::clone() const
{
return new AiWander(*this);
}
/*
* AiWander high level states (0.29.0). Not entirely accurate in some cases
* e.g. non-NPC actors do not greet and some creatures may be moving even in

View file

@ -91,8 +91,6 @@ namespace MWMechanics
AiWander (const ESM::AiSequence::AiWander* wander);
AiPackage *clone() const final;
bool execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
int getTypeId() const final;

View file

@ -8,6 +8,10 @@ namespace MWMechanics
template <class T>
struct TypedAiPackage : public AiPackage
{
virtual TypedAiPackage<T> *clone() const override
{
return new T(*static_cast<const T*>(this));
}
};
}