Merge pull request #2858 from elsid/aipackage_overriden

Mark overriden AiPackage methods as final
pull/2861/head
Bret Curtis 5 years ago committed by GitHub
commit 02385269fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -16,22 +16,22 @@ namespace MWMechanics
/// \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
**/
class AiAvoidDoor : public AiPackage
class AiAvoidDoor final : public AiPackage
{
public:
/// Avoid door until the door is fully open
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
private:
float mDuration;

@ -7,21 +7,21 @@ namespace MWMechanics
{
/// \brief AiPackage to have an actor resurface to breathe
// The AI will go up if lesser than half breath left
class AiBreathe : public AiPackage
class AiBreathe final : public AiPackage
{
public:
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
};
}
#endif

@ -11,22 +11,22 @@ namespace MWWorld
namespace MWMechanics
{
/// AiPackage which makes an actor to cast given spell.
class AiCast : public AiPackage {
class AiCast final : public AiPackage {
public:
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
private:
std::string mTargetId;

@ -91,7 +91,7 @@ namespace MWMechanics
};
/// \brief Causes the actor to fight another actor
class AiCombat : public AiPackage
class AiCombat final : public AiPackage
{
public:
///Constructor
@ -102,21 +102,21 @@ namespace MWMechanics
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
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
private:
/// Returns true if combat should end

@ -16,7 +16,7 @@ namespace AiSequence
namespace MWMechanics
{
/// \brief AI Package to have an NPC lead the player to a specific point
class AiEscort : public AiPackage
class AiEscort final : public AiPackage
{
public:
/// Implementation of AiEscort
@ -30,21 +30,21 @@ namespace MWMechanics
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:
std::string mCellId;

@ -6,20 +6,20 @@
namespace MWMechanics
{
/// AiPackage which makes an actor face a certain direction.
class AiFace : public AiPackage {
class AiFace final : public AiPackage {
public:
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
private:
float mTargetX, mTargetY;

@ -39,7 +39,7 @@ namespace MWMechanics
/// \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
**/
class AiFollow : public AiPackage
class AiFollow final : public AiPackage
{
public:
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);
virtual bool sideWithTarget() const { return true; }
virtual bool followTargetThroughDoors() const { return true; }
virtual bool shouldCancelPreviousAi() const { return !mCommanded; }
bool sideWithTarget() const final { return true; }
bool followTargetThroughDoors() const final { return true; }
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
std::string getFollowedActor();
virtual void writeState (ESM::AiSequence::AiSequence& sequence) const;
void writeState (ESM::AiSequence::AiSequence& sequence) const final;
bool isCommanded() 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();
if (target.isEmpty())

@ -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.
Note that while very similar to AiActivate, it will ONLY activate when evry close to target (Not also when the
path is completed). **/
class AiPursue : public AiPackage
class AiPursue final : public AiPackage
{
public:
///Constructor
@ -26,16 +26,16 @@ namespace MWMechanics
AiPursue(const ESM::AiSequence::AiPursue* pursue);
virtual AiPursue *clone() const;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration);
virtual int getTypeId() const;
AiPursue *clone() const final;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final;
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; }
virtual bool shouldCancelPreviousAi() const { return false; }
bool canCancel() const final { return false; }
bool shouldCancelPreviousAi() const final { return false; }
};
}
#endif

@ -14,7 +14,7 @@ namespace AiSequence
namespace MWMechanics
{
/// \brief Causes the AI to travel to the specified point
class AiTravel : public AiPackage
class AiTravel final : public AiPackage
{
public:
/// Default constructor
@ -22,21 +22,21 @@ namespace MWMechanics
AiTravel(const ESM::AiSequence::AiTravel* travel);
/// 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:
float mX;

@ -78,7 +78,7 @@ namespace MWMechanics
};
/// \brief Causes the Actor to wander within a specified range
class AiWander : public AiPackage
class AiWander final : public AiPackage
{
public:
/// Constructor
@ -91,23 +91,23 @@ namespace MWMechanics
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)
return osg::Vec3f(0, 0, 0);

Loading…
Cancel
Save