1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 01:45:34 +00:00

Merge pull request #2858 from elsid/aipackage_overriden

Mark overriden AiPackage methods as final
This commit is contained in:
Bret Curtis 2020-05-18 00:09:16 +02:00 committed by GitHub
commit 02385269fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 90 additions and 90 deletions

View file

@ -19,7 +19,7 @@ namespace MWMechanics
{ {
/// \brief Causes actor to walk to activatable object and activate it /// \brief Causes actor to walk to activatable object and activate it
/** Will activate when close to object **/ /** Will activate when close to object **/
class AiActivate : public AiPackage class AiActivate final : public AiPackage
{ {
public: public:
/// Constructor /// Constructor
@ -28,11 +28,11 @@ namespace MWMechanics
AiActivate(const ESM::AiSequence::AiActivate* activate); AiActivate(const ESM::AiSequence::AiActivate* activate);
virtual AiActivate *clone() const; AiActivate *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual void writeState(ESM::AiSequence::AiSequence& sequence) const; void writeState(ESM::AiSequence::AiSequence& sequence) const final;
private: private:
std::string mObjectId; std::string mObjectId;

View file

@ -16,22 +16,22 @@ namespace MWMechanics
/// \brief AiPackage to have an actor avoid an opening door /// \brief AiPackage to have an actor avoid an opening door
/** The AI will retreat from the door until it has finished opening, walked far away from it, or one second has passed, in an attempt to avoid it /** The AI will retreat from the door until it has finished opening, walked far away from it, or one second has passed, in an attempt to avoid it
**/ **/
class AiAvoidDoor : public AiPackage class AiAvoidDoor final : public AiPackage
{ {
public: public:
/// Avoid door until the door is fully open /// Avoid door until the door is fully open
AiAvoidDoor(const MWWorld::ConstPtr& doorPtr); AiAvoidDoor(const MWWorld::ConstPtr& doorPtr);
virtual AiAvoidDoor *clone() const; AiAvoidDoor *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual unsigned int getPriority() const; unsigned int getPriority() const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
private: private:
float mDuration; float mDuration;

View file

@ -7,21 +7,21 @@ namespace MWMechanics
{ {
/// \brief AiPackage to have an actor resurface to breathe /// \brief AiPackage to have an actor resurface to breathe
// The AI will go up if lesser than half breath left // The AI will go up if lesser than half breath left
class AiBreathe : public AiPackage class AiBreathe final : public AiPackage
{ {
public: public:
AiBreathe(); AiBreathe();
virtual AiBreathe *clone() const; AiBreathe *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual unsigned int getPriority() const; unsigned int getPriority() const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
}; };
} }
#endif #endif

View file

@ -11,22 +11,22 @@ namespace MWWorld
namespace MWMechanics namespace MWMechanics
{ {
/// AiPackage which makes an actor to cast given spell. /// AiPackage which makes an actor to cast given spell.
class AiCast : public AiPackage { class AiCast final : public AiPackage {
public: public:
AiCast(const std::string& targetId, const std::string& spellId, bool manualSpell=false); AiCast(const std::string& targetId, const std::string& spellId, bool manualSpell=false);
virtual AiPackage *clone() const; AiPackage *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual MWWorld::Ptr getTarget() const; MWWorld::Ptr getTarget() const final;
virtual unsigned int getPriority() const; unsigned int getPriority() const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
private: private:
std::string mTargetId; std::string mTargetId;

View file

@ -91,7 +91,7 @@ namespace MWMechanics
}; };
/// \brief Causes the actor to fight another actor /// \brief Causes the actor to fight another actor
class AiCombat : public AiPackage class AiCombat final : public AiPackage
{ {
public: public:
///Constructor ///Constructor
@ -102,21 +102,21 @@ namespace MWMechanics
void init(); void init();
virtual AiCombat *clone() const; AiCombat *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual unsigned int getPriority() const; unsigned int getPriority() const final;
///Returns target ID ///Returns target ID
MWWorld::Ptr getTarget() const; MWWorld::Ptr getTarget() const final;
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const; void writeState(ESM::AiSequence::AiSequence &sequence) const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
private: private:
/// Returns true if combat should end /// Returns true if combat should end

View file

@ -16,7 +16,7 @@ namespace AiSequence
namespace MWMechanics namespace MWMechanics
{ {
/// \brief AI Package to have an NPC lead the player to a specific point /// \brief AI Package to have an NPC lead the player to a specific point
class AiEscort : public AiPackage class AiEscort final : public AiPackage
{ {
public: public:
/// Implementation of AiEscort /// Implementation of AiEscort
@ -30,21 +30,21 @@ namespace MWMechanics
AiEscort(const ESM::AiSequence::AiEscort* escort); AiEscort(const ESM::AiSequence::AiEscort* escort);
virtual AiEscort *clone() const; AiEscort *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual bool useVariableSpeed() const { return true;} bool useVariableSpeed() const final { return true; }
virtual bool sideWithTarget() const { return true; } bool sideWithTarget() const final { return true; }
void writeState(ESM::AiSequence::AiSequence &sequence) const; void writeState(ESM::AiSequence::AiSequence &sequence) const final;
void fastForward(const MWWorld::Ptr& actor, AiState& state); void fastForward(const MWWorld::Ptr& actor, AiState& state) final;
virtual osg::Vec3f getDestination() const { return osg::Vec3f(mX, mY, mZ); } osg::Vec3f getDestination() const final { return osg::Vec3f(mX, mY, mZ); }
private: private:
std::string mCellId; std::string mCellId;

View file

@ -6,20 +6,20 @@
namespace MWMechanics namespace MWMechanics
{ {
/// AiPackage which makes an actor face a certain direction. /// AiPackage which makes an actor face a certain direction.
class AiFace : public AiPackage { class AiFace final : public AiPackage {
public: public:
AiFace(float targetX, float targetY); AiFace(float targetX, float targetY);
virtual AiPackage *clone() const; AiPackage *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual unsigned int getPriority() const; unsigned int getPriority() const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
private: private:
float mTargetX, mTargetY; float mTargetX, mTargetY;

View file

@ -39,7 +39,7 @@ namespace MWMechanics
/// \brief AiPackage for an actor to follow another actor/the PC /// \brief AiPackage for an actor to follow another actor/the PC
/** The AI will follow the target until a condition (time, or position) are set. Both can be disabled to cause the actor to follow the other indefinitely /** The AI will follow the target until a condition (time, or position) are set. Both can be disabled to cause the actor to follow the other indefinitely
**/ **/
class AiFollow : public AiPackage class AiFollow final : public AiPackage
{ {
public: public:
AiFollow(const std::string &actorId, float duration, float x, float y, float z); AiFollow(const std::string &actorId, float duration, float x, float y, float z);
@ -53,30 +53,30 @@ namespace MWMechanics
AiFollow(const ESM::AiSequence::AiFollow* follow); AiFollow(const ESM::AiSequence::AiFollow* follow);
virtual bool sideWithTarget() const { return true; } bool sideWithTarget() const final { return true; }
virtual bool followTargetThroughDoors() const { return true; } bool followTargetThroughDoors() const final { return true; }
virtual bool shouldCancelPreviousAi() const { return !mCommanded; } bool shouldCancelPreviousAi() const final { return !mCommanded; }
virtual AiFollow *clone() const; AiFollow *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual bool useVariableSpeed() const { return true;} bool useVariableSpeed() const final { return true; }
/// Returns the actor being followed /// Returns the actor being followed
std::string getFollowedActor(); std::string getFollowedActor();
virtual void writeState (ESM::AiSequence::AiSequence& sequence) const; void writeState (ESM::AiSequence::AiSequence& sequence) const final;
bool isCommanded() const; bool isCommanded() const;
int getFollowIndex() const; int getFollowIndex() const;
void fastForward(const MWWorld::Ptr& actor, AiState& state); void fastForward(const MWWorld::Ptr& actor, AiState& state) final;
virtual osg::Vec3f getDestination() const osg::Vec3f getDestination() const final
{ {
MWWorld::Ptr target = getTarget(); MWWorld::Ptr target = getTarget();
if (target.isEmpty()) if (target.isEmpty())

View file

@ -17,7 +17,7 @@ namespace MWMechanics
/** Used for arresting players. Causes the actor to run to the pursued actor and activate them, to arrest them. /** Used for arresting players. Causes the actor to run to the pursued actor and activate them, to arrest them.
Note that while very similar to AiActivate, it will ONLY activate when evry close to target (Not also when the Note that while very similar to AiActivate, it will ONLY activate when evry close to target (Not also when the
path is completed). **/ path is completed). **/
class AiPursue : public AiPackage class AiPursue final : public AiPackage
{ {
public: public:
///Constructor ///Constructor
@ -26,16 +26,16 @@ namespace MWMechanics
AiPursue(const ESM::AiSequence::AiPursue* pursue); AiPursue(const ESM::AiSequence::AiPursue* pursue);
virtual AiPursue *clone() const; AiPursue *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
MWWorld::Ptr getTarget() const; MWWorld::Ptr getTarget() const final;
virtual void writeState (ESM::AiSequence::AiSequence& sequence) const; void writeState (ESM::AiSequence::AiSequence& sequence) const final;
virtual bool canCancel() const { return false; } bool canCancel() const final { return false; }
virtual bool shouldCancelPreviousAi() const { return false; } bool shouldCancelPreviousAi() const final { return false; }
}; };
} }
#endif #endif

View file

@ -14,7 +14,7 @@ namespace AiSequence
namespace MWMechanics namespace MWMechanics
{ {
/// \brief Causes the AI to travel to the specified point /// \brief Causes the AI to travel to the specified point
class AiTravel : public AiPackage class AiTravel final : public AiPackage
{ {
public: public:
/// Default constructor /// Default constructor
@ -22,21 +22,21 @@ namespace MWMechanics
AiTravel(const ESM::AiSequence::AiTravel* travel); AiTravel(const ESM::AiSequence::AiTravel* travel);
/// Simulates the passing of time /// Simulates the passing of time
virtual void fastForward(const MWWorld::Ptr& actor, AiState& state); void fastForward(const MWWorld::Ptr& actor, AiState& state) final;
void writeState(ESM::AiSequence::AiSequence &sequence) const; void writeState(ESM::AiSequence::AiSequence &sequence) const final;
virtual AiTravel *clone() const; AiTravel *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual bool useVariableSpeed() const { return true;} bool useVariableSpeed() const final { return true; }
virtual bool alwaysActive() const { return true; } bool alwaysActive() const final { return true; }
virtual osg::Vec3f getDestination() const { return osg::Vec3f(mX, mY, mZ); } osg::Vec3f getDestination() const final { return osg::Vec3f(mX, mY, mZ); }
private: private:
float mX; float mX;

View file

@ -78,7 +78,7 @@ namespace MWMechanics
}; };
/// \brief Causes the Actor to wander within a specified range /// \brief Causes the Actor to wander within a specified range
class AiWander : public AiPackage class AiWander final : public AiPackage
{ {
public: public:
/// Constructor /// Constructor
@ -91,23 +91,23 @@ namespace MWMechanics
AiWander (const ESM::AiSequence::AiWander* wander); AiWander (const ESM::AiSequence::AiWander* wander);
virtual AiPackage *clone() const; AiPackage *clone() const final;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); bool execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
virtual int getTypeId() const; int getTypeId() const final;
virtual bool useVariableSpeed() const { return true;} bool useVariableSpeed() const final { return true; }
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const; void writeState(ESM::AiSequence::AiSequence &sequence) const final;
virtual void fastForward(const MWWorld::Ptr& actor, AiState& state); void fastForward(const MWWorld::Ptr& actor, AiState& state) final;
bool getRepeat() const; bool getRepeat() const final;
osg::Vec3f getDestination(const MWWorld::Ptr& actor) const; osg::Vec3f getDestination(const MWWorld::Ptr& actor) const final;
virtual osg::Vec3f getDestination() const osg::Vec3f getDestination() const final
{ {
if (!mHasDestination) if (!mHasDestination)
return osg::Vec3f(0, 0, 0); return osg::Vec3f(0, 0, 0);