components/compiler cleanup; also cleaned up related cascading warnings; fixed up final/override issues

pull/3022/head
Bret Curtis 4 years ago
parent 5475e696c8
commit 5a824d0333

@ -59,38 +59,38 @@ namespace CSVRender
/// Editmode for terrain shape grid /// Editmode for terrain shape grid
TerrainShapeMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr); TerrainShapeMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr);
void primaryOpenPressed (const WorldspaceHitResult& hit) final; void primaryOpenPressed (const WorldspaceHitResult& hit) override;
/// Create single command for one-click shape editing /// Create single command for one-click shape editing
void primaryEditPressed (const WorldspaceHitResult& hit) final; void primaryEditPressed (const WorldspaceHitResult& hit) override;
/// Open brush settings window /// Open brush settings window
void primarySelectPressed(const WorldspaceHitResult&) final; void primarySelectPressed(const WorldspaceHitResult&) override;
void secondarySelectPressed(const WorldspaceHitResult&) final; void secondarySelectPressed(const WorldspaceHitResult&) override;
void activate(CSVWidget::SceneToolbar*) final; void activate(CSVWidget::SceneToolbar*) override;
void deactivate(CSVWidget::SceneToolbar*) final; void deactivate(CSVWidget::SceneToolbar*) override;
/// Start shape editing command macro /// Start shape editing command macro
bool primaryEditStartDrag (const QPoint& pos) final; bool primaryEditStartDrag (const QPoint& pos) override;
bool secondaryEditStartDrag (const QPoint& pos) final; bool secondaryEditStartDrag (const QPoint& pos) override;
bool primarySelectStartDrag (const QPoint& pos) final; bool primarySelectStartDrag (const QPoint& pos) override;
bool secondarySelectStartDrag (const QPoint& pos) final; bool secondarySelectStartDrag (const QPoint& pos) override;
/// Handle shape edit behavior during dragging /// Handle shape edit behavior during dragging
void drag (const QPoint& pos, int diffX, int diffY, double speedFactor) final; void drag (const QPoint& pos, int diffX, int diffY, double speedFactor) override;
/// End shape editing command macro /// End shape editing command macro
void dragCompleted(const QPoint& pos) final; void dragCompleted(const QPoint& pos) override;
/// Cancel shape editing, and reset all pending changes /// Cancel shape editing, and reset all pending changes
void dragAborted() final; void dragAborted() override;
void dragWheel (int diff, double speedFactor) final; void dragWheel (int diff, double speedFactor) override;
void dragMoveEvent (QDragMoveEvent *event) final; void dragMoveEvent (QDragMoveEvent *event) override;
void mouseMoveEvent (QMouseEvent *event) final; void mouseMoveEvent (QMouseEvent *event) override;
private: private:

@ -27,10 +27,10 @@ namespace CSVRender
const CSMWorld::Data& mData; const CSMWorld::Data& mData;
std::array<float, ESM::Land::LAND_SIZE * ESM::Land::LAND_SIZE> mAlteredHeight; std::array<float, ESM::Land::LAND_SIZE * ESM::Land::LAND_SIZE> mAlteredHeight;
osg::ref_ptr<const ESMTerrain::LandObject> getLand (int cellX, int cellY) final; osg::ref_ptr<const ESMTerrain::LandObject> getLand (int cellX, int cellY) override;
const ESM::LandTexture* getLandTexture(int index, short plugin) final; const ESM::LandTexture* getLandTexture(int index, short plugin) override;
void getBounds(float& minX, float& maxX, float& minY, float& maxY) final; void getBounds(float& minX, float& maxX, float& minY, float& maxY) override;
int getThisHeight(int col, int row, const ESM::Land::LandData *heightData) const; int getThisHeight(int col, int row, const ESM::Land::LandData *heightData) const;
int getLeftHeight(int col, int row, const ESM::Land::LandData *heightData) const; int getLeftHeight(int col, int row, const ESM::Land::LandData *heightData) const;
@ -44,8 +44,8 @@ namespace CSVRender
bool leftOrUpIsOverTheLimit(int col, int row, int heightWarningLimit, const ESM::Land::LandData *heightData) const; bool leftOrUpIsOverTheLimit(int col, int row, int heightWarningLimit, const ESM::Land::LandData *heightData) const;
bool rightOrDownIsOverTheLimit(int col, int row, int heightWarningLimit, const ESM::Land::LandData *heightData) const; bool rightOrDownIsOverTheLimit(int col, int row, int heightWarningLimit, const ESM::Land::LandData *heightData) const;
void adjustColor(int col, int row, const ESM::Land::LandData *heightData, osg::Vec4ub& color) const final; void adjustColor(int col, int row, const ESM::Land::LandData *heightData, osg::Vec4ub& color) const override;
float getAlteredHeight(int col, int row) const final; float getAlteredHeight(int col, int row) const override;
}; };
} }

@ -53,37 +53,37 @@ namespace CSVRender
/// \brief Editmode for terrain texture grid /// \brief Editmode for terrain texture grid
TerrainTextureMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr); TerrainTextureMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr);
void primaryOpenPressed (const WorldspaceHitResult& hit) final; void primaryOpenPressed (const WorldspaceHitResult& hit) override;
/// \brief Create single command for one-click texture editing /// \brief Create single command for one-click texture editing
void primaryEditPressed (const WorldspaceHitResult& hit) final; void primaryEditPressed (const WorldspaceHitResult& hit) override;
/// \brief Open brush settings window /// \brief Open brush settings window
void primarySelectPressed(const WorldspaceHitResult&) final; void primarySelectPressed(const WorldspaceHitResult&) override;
void secondarySelectPressed(const WorldspaceHitResult&) final; void secondarySelectPressed(const WorldspaceHitResult&) override;
void activate(CSVWidget::SceneToolbar*) final; void activate(CSVWidget::SceneToolbar*) override;
void deactivate(CSVWidget::SceneToolbar*) final; void deactivate(CSVWidget::SceneToolbar*) override;
/// \brief Start texture editing command macro /// \brief Start texture editing command macro
bool primaryEditStartDrag (const QPoint& pos) final; bool primaryEditStartDrag (const QPoint& pos) override;
bool secondaryEditStartDrag (const QPoint& pos) final; bool secondaryEditStartDrag (const QPoint& pos) override;
bool primarySelectStartDrag (const QPoint& pos) final; bool primarySelectStartDrag (const QPoint& pos) override;
bool secondarySelectStartDrag (const QPoint& pos) final; bool secondarySelectStartDrag (const QPoint& pos) override;
/// \brief Handle texture edit behavior during dragging /// \brief Handle texture edit behavior during dragging
void drag (const QPoint& pos, int diffX, int diffY, double speedFactor) final; void drag (const QPoint& pos, int diffX, int diffY, double speedFactor) override;
/// \brief End texture editing command macro /// \brief End texture editing command macro
void dragCompleted(const QPoint& pos) final; void dragCompleted(const QPoint& pos) override;
void dragAborted() final; void dragAborted() override;
void dragWheel (int diff, double speedFactor) final; void dragWheel (int diff, double speedFactor) override;
void dragMoveEvent (QDragMoveEvent *event) final; void dragMoveEvent (QDragMoveEvent *event) override;
void mouseMoveEvent (QMouseEvent *event) final; void mouseMoveEvent (QMouseEvent *event) override;
private: private:
/// \brief Handle brush mechanics, maths regarding worldspace hit etc. /// \brief Handle brush mechanics, maths regarding worldspace hit etc.

@ -132,11 +132,11 @@ namespace MWClass
void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount) const override; void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount) const override;
float getWalkSpeed(const MWWorld::Ptr& ptr) const final; float getWalkSpeed(const MWWorld::Ptr& ptr) const override;
float getRunSpeed(const MWWorld::Ptr& ptr) const final; float getRunSpeed(const MWWorld::Ptr& ptr) const override;
float getSwimSpeed(const MWWorld::Ptr& ptr) const final; float getSwimSpeed(const MWWorld::Ptr& ptr) const override;
}; };
} }

@ -166,11 +166,11 @@ namespace MWClass
void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount) const override; void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount) const override;
float getWalkSpeed(const MWWorld::Ptr& ptr) const final; float getWalkSpeed(const MWWorld::Ptr& ptr) const override;
float getRunSpeed(const MWWorld::Ptr& ptr) const final; float getRunSpeed(const MWWorld::Ptr& ptr) const override;
float getSwimSpeed(const MWWorld::Ptr& ptr) const final; float getSwimSpeed(const MWWorld::Ptr& ptr) const override;
}; };
} }

@ -73,9 +73,9 @@ namespace MWDialogue
bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) override; bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) override;
std::list<std::string> getAvailableTopics() override; std::list<std::string> getAvailableTopics() override;
int getTopicFlag(const std::string& topicId) final; int getTopicFlag(const std::string& topicId) override;
bool inJournal (const std::string& topicId, const std::string& infoId) final; bool inJournal (const std::string& topicId, const std::string& infoId) override;
void addTopic (const std::string& topic) override; void addTopic (const std::string& topic) override;

@ -22,8 +22,8 @@ namespace MWGui
*/ */
void setBackgroundImage (const std::string& image, bool fixedRatio=true, bool stretch=true); void setBackgroundImage (const std::string& image, bool fixedRatio=true, bool stretch=true);
void setSize (const MyGUI::IntSize &_value) final; void setSize (const MyGUI::IntSize &_value) override;
void setCoord (const MyGUI::IntCoord &_value) final; void setCoord (const MyGUI::IntCoord &_value) override;
private: private:
MyGUI::ImageBox* mChild; MyGUI::ImageBox* mChild;

@ -1152,7 +1152,7 @@ public:
i->second->createDrawItem (mNode); i->second->createDrawItem (mNode);
} }
void setVisible (bool newVisible) final void setVisible (bool newVisible) override
{ {
if (mVisible == newVisible) if (mVisible == newVisible)
return; return;
@ -1174,7 +1174,7 @@ public:
} }
} }
void createDrawItem(MyGUI::ITexture* texture, MyGUI::ILayerNode* node) final void createDrawItem(MyGUI::ITexture* texture, MyGUI::ILayerNode* node) override
{ {
mNode = node; mNode = node;
@ -1242,9 +1242,9 @@ public:
// ISubWidget should not necessarily be a drawitem // ISubWidget should not necessarily be a drawitem
// in this case, it is not... // in this case, it is not...
void doRender() final { } void doRender() override { }
void _updateView () final void _updateView () override
{ {
_checkMargin(); _checkMargin();
@ -1253,7 +1253,7 @@ public:
mNode->outOfDate (i->second->mRenderItem); mNode->outOfDate (i->second->mRenderItem);
} }
void _correctView() final void _correctView() override
{ {
_checkMargin (); _checkMargin ();
@ -1263,7 +1263,7 @@ public:
} }
void destroyDrawItem() final void destroyDrawItem() override
{ {
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i) for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
i->second->destroyDrawItem (mNode); i->second->destroyDrawItem (mNode);
@ -1283,24 +1283,24 @@ public:
{ {
} }
void showPage (TypesetBook::Ptr book, size_t page) final void showPage (TypesetBook::Ptr book, size_t page) override
{ {
mPageDisplay->showPage (book, page); mPageDisplay->showPage (book, page);
} }
void adviseLinkClicked (std::function <void (InteractiveId)> linkClicked) final void adviseLinkClicked (std::function <void (InteractiveId)> linkClicked) override
{ {
mPageDisplay->mLinkClicked = linkClicked; mPageDisplay->mLinkClicked = linkClicked;
} }
void unadviseLinkClicked () final void unadviseLinkClicked () override
{ {
mPageDisplay->mLinkClicked = std::function <void (InteractiveId)> (); mPageDisplay->mLinkClicked = std::function <void (InteractiveId)> ();
} }
protected: protected:
void initialiseOverride() final void initialiseOverride() override
{ {
Base::initialiseOverride(); Base::initialiseOverride();
@ -1314,24 +1314,24 @@ protected:
} }
} }
void onMouseLostFocus(Widget* _new) final void onMouseLostFocus(Widget* _new) override
{ {
// NOTE: MyGUI also fires eventMouseLostFocus for widgets that are about to be destroyed (if they had focus). // NOTE: MyGUI also fires eventMouseLostFocus for widgets that are about to be destroyed (if they had focus).
// Child widgets may already be destroyed! So be careful. // Child widgets may already be destroyed! So be careful.
mPageDisplay->onMouseLostFocus (); mPageDisplay->onMouseLostFocus ();
} }
void onMouseMove(int left, int top) final void onMouseMove(int left, int top) override
{ {
mPageDisplay->onMouseMove (left, top); mPageDisplay->onMouseMove (left, top);
} }
void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id) final void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id) override
{ {
mPageDisplay->onMouseButtonPressed (left, top, id); mPageDisplay->onMouseButtonPressed (left, top, id);
} }
void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id) final void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id) override
{ {
mPageDisplay->onMouseButtonReleased (left, top, id); mPageDisplay->onMouseButtonReleased (left, top, id);
} }

@ -9,21 +9,17 @@ namespace MyGUI
class Widget; class Widget;
} }
namespace MWGui namespace MWGui::Controllers
{
namespace Controllers
{ {
/// Automatically positions a widget below the mouse cursor. /// Automatically positions a widget below the mouse cursor.
class ControllerFollowMouse final : class ControllerFollowMouse final : public MyGUI::ControllerItem
public MyGUI::ControllerItem
{ {
MYGUI_RTTI_DERIVED( ControllerFollowMouse ) MYGUI_RTTI_DERIVED( ControllerFollowMouse )
private: private:
bool addTime(MyGUI::Widget* _widget, float _time) final; bool addTime(MyGUI::Widget* _widget, float _time) override;
void prepareItem(MyGUI::Widget* _widget) final; void prepareItem(MyGUI::Widget* _widget) override;
}; };
} }
}
#endif #endif

@ -20,10 +20,10 @@ namespace MWGui
ResourceImageSetPointerFix(); ResourceImageSetPointerFix();
virtual ~ResourceImageSetPointerFix(); virtual ~ResourceImageSetPointerFix();
void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) final; void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) override;
void setImage(MyGUI::ImageBox* _image) final; void setImage(MyGUI::ImageBox* _image) override;
void setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point) final; void setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point) override;
//and now for the whole point of this class, allow us to get //and now for the whole point of this class, allow us to get
//the hot spot, the image and the size of the cursor. //the hot spot, the image and the size of the cursor.

@ -36,7 +36,7 @@ namespace MWGui
/// Register needed components with MyGUI's factory manager /// Register needed components with MyGUI's factory manager
static void registerComponents(); static void registerComponents();
void initialiseOverride() final; void initialiseOverride() override;
/// Takes ownership of \a model /// Takes ownership of \a model
void setModel(ItemModel* model); void setModel(ItemModel* model);
@ -47,8 +47,8 @@ namespace MWGui
void layoutWidgets(); void layoutWidgets();
void resetScrollbars(); void resetScrollbars();
void setSize(const MyGUI::IntSize& value) final; void setSize(const MyGUI::IntSize& value) override;
void setCoord(const MyGUI::IntCoord& value) final; void setCoord(const MyGUI::IntCoord& value) override;
MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, const MWWorld::Ptr&> eventItemClicked; MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, const MWWorld::Ptr&> eventItemClicked;

@ -13,7 +13,7 @@ namespace MWGui
MYGUI_RTTI_DERIVED(ItemView) MYGUI_RTTI_DERIVED(ItemView)
public: public:
ItemView(); ItemView();
virtual ~ItemView(); ~ItemView() override;
/// Register needed components with MyGUI's factory manager /// Register needed components with MyGUI's factory manager
static void registerComponents (); static void registerComponents ();
@ -33,12 +33,12 @@ namespace MWGui
void resetScrollBars(); void resetScrollBars();
private: private:
void initialiseOverride() final; void initialiseOverride() override;
void layoutWidgets(); void layoutWidgets();
void setSize(const MyGUI::IntSize& _value) final; void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) final; void setCoord(const MyGUI::IntCoord& _value) override;
void onSelectedItem (MyGUI::Widget* sender); void onSelectedItem (MyGUI::Widget* sender);
void onSelectedBackground (MyGUI::Widget* sender); void onSelectedBackground (MyGUI::Widget* sender);

@ -41,7 +41,7 @@ namespace MWGui
void setFrame (const std::string& frame, const MyGUI::IntCoord& coord); void setFrame (const std::string& frame, const MyGUI::IntCoord& coord);
protected: protected:
void initialiseOverride() final; void initialiseOverride() override;
MyGUI::ImageBox* mItem; MyGUI::ImageBox* mItem;
MyGUI::ImageBox* mItemShadow; MyGUI::ImageBox* mItemShadow;

@ -74,12 +74,12 @@ namespace
MyGUI::Colour mNormalColour; MyGUI::Colour mNormalColour;
MyGUI::Colour mHoverColour; MyGUI::Colour mHoverColour;
void onMouseLostFocus(MyGUI::Widget* _new) final void onMouseLostFocus(MyGUI::Widget* _new) override
{ {
setColour(mNormalColour); setColour(mNormalColour);
} }
void onMouseSetFocus(MyGUI::Widget* _old) final void onMouseSetFocus(MyGUI::Widget* _old) override
{ {
setColour(mHoverColour); setColour(mHoverColour);
} }

@ -10,7 +10,7 @@ namespace MWGui
MYGUI_RTTI_DERIVED( AutoSizedResourceSkin ) MYGUI_RTTI_DERIVED( AutoSizedResourceSkin )
public: public:
void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) final; void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) override;
}; };
} }

@ -47,10 +47,10 @@ namespace MWGui
/// Fired when a spell was clicked /// Fired when a spell was clicked
EventHandle_ModelIndex eventSpellClicked; EventHandle_ModelIndex eventSpellClicked;
void initialiseOverride() final; void initialiseOverride() override;
void setSize(const MyGUI::IntSize& _value) final; void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) final; void setCoord(const MyGUI::IntCoord& _value) override;
void resetScrollbars(); void resetScrollbars();

@ -116,7 +116,7 @@ namespace MWGui
protected: protected:
virtual ~MWSkill(); virtual ~MWSkill();
void initialiseOverride() final; void initialiseOverride() override;
void onClicked(MyGUI::Widget* _sender); void onClicked(MyGUI::Widget* _sender);
@ -156,7 +156,7 @@ namespace MWGui
protected: protected:
virtual ~MWAttribute(); virtual ~MWAttribute();
void initialiseOverride() final; void initialiseOverride() override;
void onClicked(MyGUI::Widget* _sender); void onClicked(MyGUI::Widget* _sender);
@ -199,7 +199,7 @@ namespace MWGui
protected: protected:
virtual ~MWSpell(); virtual ~MWSpell();
void initialiseOverride() final; void initialiseOverride() override;
private: private:
void updateWidgets(); void updateWidgets();
@ -241,7 +241,7 @@ namespace MWGui
protected: protected:
virtual ~MWEffectList(); virtual ~MWEffectList();
void initialiseOverride() final; void initialiseOverride() override;
private: private:
void updateWidgets(); void updateWidgets();
@ -265,7 +265,7 @@ namespace MWGui
protected: protected:
virtual ~MWSpellEffect(); virtual ~MWSpellEffect();
void initialiseOverride() final; void initialiseOverride() override;
private: private:
static const int sIconOffset = 24; static const int sIconOffset = 24;
@ -294,7 +294,7 @@ namespace MWGui
protected: protected:
virtual ~MWDynamicStat(); virtual ~MWDynamicStat();
void initialiseOverride() final; void initialiseOverride() override;
private: private:

@ -24,15 +24,15 @@ namespace MWMechanics
public: public:
/// Constructor /// Constructor
/** \param objectId Reference to object to activate **/ /** \param objectId Reference to object to activate **/
AiActivate(const std::string &objectId); explicit AiActivate(const std::string &objectId);
AiActivate(const ESM::AiSequence::AiActivate* activate); explicit AiActivate(const ESM::AiSequence::AiActivate* activate);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Activate; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Activate; }
void writeState(ESM::AiSequence::AiSequence& sequence) const final; void writeState(ESM::AiSequence::AiSequence& sequence) const override;
private: private:
const std::string mObjectId; const std::string mObjectId;

@ -20,9 +20,9 @@ namespace MWMechanics
{ {
public: public:
/// Avoid door until the door is fully open /// Avoid door until the door is fully open
AiAvoidDoor(const MWWorld::ConstPtr& doorPtr); explicit AiAvoidDoor(const MWWorld::ConstPtr& doorPtr);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::AvoidDoor; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::AvoidDoor; }

@ -10,7 +10,7 @@ namespace MWMechanics
class AiBreathe final : public TypedAiPackage<AiBreathe> class AiBreathe final : public TypedAiPackage<AiBreathe>
{ {
public: public:
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Breathe; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Breathe; }

@ -15,11 +15,11 @@ namespace MWMechanics
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);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Cast; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Cast; }
MWWorld::Ptr getTarget() const final; MWWorld::Ptr getTarget() const override;
static constexpr Options makeDefaultOptions() static constexpr Options makeDefaultOptions()
{ {

@ -96,13 +96,13 @@ namespace MWMechanics
public: public:
///Constructor ///Constructor
/** \param actor Actor to fight **/ /** \param actor Actor to fight **/
AiCombat(const MWWorld::Ptr& actor); explicit AiCombat(const MWWorld::Ptr& actor);
AiCombat (const ESM::AiSequence::AiCombat* combat); explicit AiCombat (const ESM::AiSequence::AiCombat* combat);
void init(); void init();
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Combat; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Combat; }
@ -116,9 +116,9 @@ namespace MWMechanics
} }
///Returns target ID ///Returns target ID
MWWorld::Ptr getTarget() const final; MWWorld::Ptr getTarget() const override;
void writeState(ESM::AiSequence::AiSequence &sequence) const final; void writeState(ESM::AiSequence::AiSequence &sequence) const override;
private: private:
/// Returns true if combat should end /// Returns true if combat should end

@ -30,7 +30,7 @@ namespace MWMechanics
AiEscort(const ESM::AiSequence::AiEscort* escort); AiEscort(const ESM::AiSequence::AiEscort* escort);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Escort; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Escort; }
@ -42,11 +42,11 @@ namespace MWMechanics
return options; return options;
} }
void writeState(ESM::AiSequence::AiSequence &sequence) const final; void writeState(ESM::AiSequence::AiSequence &sequence) const override;
void fastForward(const MWWorld::Ptr& actor, AiState& state) final; void fastForward(const MWWorld::Ptr& actor, AiState& state) override;
osg::Vec3f getDestination() const final { return osg::Vec3f(mX, mY, mZ); } osg::Vec3f getDestination() const override { return osg::Vec3f(mX, mY, mZ); }
private: private:
const std::string mCellId; const std::string mCellId;

@ -10,7 +10,7 @@ namespace MWMechanics
public: public:
AiFace(float targetX, float targetY); AiFace(float targetX, float targetY);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Face; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Face; }

@ -53,7 +53,7 @@ namespace MWMechanics
AiFollow(const ESM::AiSequence::AiFollow* follow); AiFollow(const ESM::AiSequence::AiFollow* follow);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Follow; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Follow; }
@ -69,15 +69,15 @@ namespace MWMechanics
/// Returns the actor being followed /// Returns the actor being followed
std::string getFollowedActor(); std::string getFollowedActor();
void writeState (ESM::AiSequence::AiSequence& sequence) const final; void writeState (ESM::AiSequence::AiSequence& sequence) const override;
bool isCommanded() const; bool isCommanded() const;
int getFollowIndex() const; int getFollowIndex() const;
void fastForward(const MWWorld::Ptr& actor, AiState& state) final; void fastForward(const MWWorld::Ptr& actor, AiState& state) override;
osg::Vec3f getDestination() const final osg::Vec3f getDestination() const override
{ {
MWWorld::Ptr target = getTarget(); MWWorld::Ptr target = getTarget();
if (target.isEmpty()) if (target.isEmpty())

@ -26,7 +26,7 @@ namespace MWMechanics
AiPursue(const ESM::AiSequence::AiPursue* pursue); AiPursue(const ESM::AiSequence::AiPursue* pursue);
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Pursue; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Pursue; }
@ -38,9 +38,9 @@ namespace MWMechanics
return options; return options;
} }
MWWorld::Ptr getTarget() const final; MWWorld::Ptr getTarget() const override;
void writeState (ESM::AiSequence::AiSequence& sequence) const final; void writeState (ESM::AiSequence::AiSequence& sequence) const override;
}; };
} }
#endif #endif

@ -25,14 +25,14 @@ namespace MWMechanics
AiTravel(float x, float y, float z); AiTravel(float x, float y, float z);
AiTravel(const ESM::AiSequence::AiTravel* travel); explicit AiTravel(const ESM::AiSequence::AiTravel* travel);
/// Simulates the passing of time /// Simulates the passing of time
void fastForward(const MWWorld::Ptr& actor, AiState& state) final; void fastForward(const MWWorld::Ptr& actor, AiState& state) override;
void writeState(ESM::AiSequence::AiSequence &sequence) const final; void writeState(ESM::AiSequence::AiSequence &sequence) const override;
bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Travel; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Travel; }
@ -44,7 +44,7 @@ namespace MWMechanics
return options; return options;
} }
osg::Vec3f getDestination() const final { return osg::Vec3f(mX, mY, mZ); } osg::Vec3f getDestination() const override { return osg::Vec3f(mX, mY, mZ); }
private: private:
const float mX; const float mX;
@ -62,7 +62,7 @@ namespace MWMechanics
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::InternalTravel; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::InternalTravel; }
std::unique_ptr<AiPackage> clone() const final; std::unique_ptr<AiPackage> clone() const override;
}; };
} }

@ -89,9 +89,9 @@ namespace MWMechanics
\param repeat Repeat wander or not **/ \param repeat Repeat wander or not **/
AiWander(int distance, int duration, int timeOfDay, const std::vector<unsigned char>& idle, bool repeat); AiWander(int distance, int duration, int timeOfDay, const std::vector<unsigned char>& idle, bool repeat);
AiWander (const ESM::AiSequence::AiWander* wander); explicit AiWander (const ESM::AiSequence::AiWander* wander);
bool execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) final; bool execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) override;
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Wander; } static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Wander; }
@ -103,13 +103,13 @@ namespace MWMechanics
return options; return options;
} }
void writeState(ESM::AiSequence::AiSequence &sequence) const final; void writeState(ESM::AiSequence::AiSequence &sequence) const override;
void fastForward(const MWWorld::Ptr& actor, AiState& state) final; void fastForward(const MWWorld::Ptr& actor, AiState& state) override;
osg::Vec3f getDestination(const MWWorld::Ptr& actor) const final; osg::Vec3f getDestination(const MWWorld::Ptr& actor) const override;
osg::Vec3f getDestination() const final osg::Vec3f getDestination() const override
{ {
if (!mHasDestination) if (!mHasDestination)
return osg::Vec3f(0, 0, 0); return osg::Vec3f(0, 0, 0);

@ -35,7 +35,7 @@ namespace MWPhysics
{ {
} }
bool process(const btBroadphaseProxy* proxy) final bool process(const btBroadphaseProxy* proxy) override
{ {
if (mResult) if (mResult)
return false; return false;

@ -156,17 +156,17 @@ namespace MWPhysics
/// target vector hits the collision shape and then calculates distance from the intersection point. /// target vector hits the collision shape and then calculates distance from the intersection point.
/// This can be used to find out how much nearer we need to move to the target for a "getHitContact" to be successful. /// This can be used to find out how much nearer we need to move to the target for a "getHitContact" to be successful.
/// \note Only Actor targets are supported at the moment. /// \note Only Actor targets are supported at the moment.
float getHitDistance(const osg::Vec3f& point, const MWWorld::ConstPtr& target) const final; float getHitDistance(const osg::Vec3f& point, const MWWorld::ConstPtr& target) const override;
/// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors. /// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors.
RayCastingResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(), RayCastingResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(),
std::vector<MWWorld::Ptr> targets = std::vector<MWWorld::Ptr>(), std::vector<MWWorld::Ptr> targets = std::vector<MWWorld::Ptr>(),
int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const final; int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const override;
RayCastingResult castSphere(const osg::Vec3f& from, const osg::Vec3f& to, float radius) const final; RayCastingResult castSphere(const osg::Vec3f& from, const osg::Vec3f& to, float radius) const override;
/// Return true if actor1 can see actor2. /// Return true if actor1 can see actor2.
bool getLineOfSight(const MWWorld::ConstPtr& actor1, const MWWorld::ConstPtr& actor2) const final; bool getLineOfSight(const MWWorld::ConstPtr& actor1, const MWWorld::ConstPtr& actor2) const override;
bool isOnGround (const MWWorld::Ptr& actor); bool isOnGround (const MWWorld::Ptr& actor);

@ -5,14 +5,14 @@ struct PartialBinarySearchTest : public ::testing::Test
{ {
protected: protected:
std::vector<std::string> mDataVec; std::vector<std::string> mDataVec;
virtual void SetUp() void SetUp() override
{ {
const char* data[] = { "Head", "Chest", "Tri Head", "Tri Chest", "Bip01", "Tri Bip01" }; const char* data[] = { "Head", "Chest", "Tri Head", "Tri Chest", "Bip01", "Tri Bip01" };
mDataVec = std::vector<std::string>(data, data+sizeof(data)/sizeof(data[0])); mDataVec = std::vector<std::string>(data, data+sizeof(data)/sizeof(data[0]));
std::sort(mDataVec.begin(), mDataVec.end(), Misc::StringUtils::ciLess); std::sort(mDataVec.begin(), mDataVec.end(), Misc::StringUtils::ciLess);
} }
virtual void TearDown() void TearDown() override
{ {
} }

@ -4,11 +4,11 @@
struct KeywordSearchTest : public ::testing::Test struct KeywordSearchTest : public ::testing::Test
{ {
protected: protected:
virtual void SetUp() void SetUp() override
{ {
} }
virtual void TearDown() void TearDown() override
{ {
} }
}; };

@ -22,7 +22,7 @@ struct ContentFileTest : public ::testing::Test
{ {
protected: protected:
virtual void SetUp() void SetUp() override
{ {
readContentFiles(); readContentFiles();
@ -31,13 +31,13 @@ struct ContentFileTest : public ::testing::Test
readerList.resize(mContentFiles.size()); readerList.resize(mContentFiles.size());
int index=0; int index=0;
for (std::vector<boost::filesystem::path>::const_iterator it = mContentFiles.begin(); it != mContentFiles.end(); ++it) for (const auto & mContentFile : mContentFiles)
{ {
ESM::ESMReader lEsm; ESM::ESMReader lEsm;
lEsm.setEncoder(nullptr); lEsm.setEncoder(nullptr);
lEsm.setIndex(index); lEsm.setIndex(index);
lEsm.setGlobalReaderList(&readerList); lEsm.setGlobalReaderList(&readerList);
lEsm.open(it->string()); lEsm.open(mContentFile.string());
readerList[index] = lEsm; readerList[index] = lEsm;
mEsmStore.load(readerList[index], &dummyListener); mEsmStore.load(readerList[index], &dummyListener);
@ -47,7 +47,7 @@ struct ContentFileTest : public ::testing::Test
mEsmStore.setUp(); mEsmStore.setUp();
} }
virtual void TearDown() void TearDown() override
{ {
} }
@ -86,8 +86,8 @@ struct ContentFileTest : public ::testing::Test
Files::Collections collections (dataDirs, true); Files::Collections collections (dataDirs, true);
std::vector<std::string> contentFiles = variables["content"].as<std::vector<std::string> >(); std::vector<std::string> contentFiles = variables["content"].as<std::vector<std::string> >();
for (std::vector<std::string>::iterator it = contentFiles.begin(); it != contentFiles.end(); ++it) for (auto & contentFile : contentFiles)
mContentFiles.push_back(collections.getPath(*it)); mContentFiles.push_back(collections.getPath(contentFile));
} }
protected: protected:
@ -111,14 +111,12 @@ TEST_F(ContentFileTest, dialogue_merging_test)
stream.open(file); stream.open(file);
const MWWorld::Store<ESM::Dialogue>& dialStore = mEsmStore.get<ESM::Dialogue>(); const MWWorld::Store<ESM::Dialogue>& dialStore = mEsmStore.get<ESM::Dialogue>();
for (MWWorld::Store<ESM::Dialogue>::iterator it = dialStore.begin(); it != dialStore.end(); ++it) for (const auto & dial : dialStore)
{ {
const ESM::Dialogue& dial = *it;
stream << "Dialogue: " << dial.mId << std::endl; stream << "Dialogue: " << dial.mId << std::endl;
for (ESM::Dialogue::InfoContainer::const_iterator infoIt = dial.mInfo.begin(); infoIt != dial.mInfo.end(); ++infoIt) for (const auto & info : dial.mInfo)
{ {
const ESM::DialInfo& info = *infoIt;
stream << info.mId << std::endl; stream << info.mId << std::endl;
} }
stream << std::endl; stream << std::endl;
@ -229,7 +227,7 @@ template <typename T>
Files::IStreamPtr getEsmFile(T record, bool deleted) Files::IStreamPtr getEsmFile(T record, bool deleted)
{ {
ESM::ESMWriter writer; ESM::ESMWriter writer;
std::stringstream* stream = new std::stringstream; auto* stream = new std::stringstream;
writer.setFormat(0); writer.setFormat(0);
writer.save(*stream); writer.save(*stream);
writer.startRecord(T::sRecordId); writer.startRecord(T::sRecordId);

@ -15,7 +15,7 @@ namespace Compiler
Context() : mExtensions (0) {} Context() : mExtensions (0) {}
virtual ~Context() {} virtual ~Context() = default;
virtual bool canDeclareLocals() const = 0; virtual bool canDeclareLocals() const = 0;
///< Is the compiler allowed to declare local variables? ///< Is the compiler allowed to declare local variables?

@ -1,7 +1,6 @@
#include "controlparser.hpp" #include "controlparser.hpp"
#include <algorithm> #include <algorithm>
#include <iterator>
#include <stdexcept> #include <stdexcept>
#include "scanner.hpp" #include "scanner.hpp"
@ -33,7 +32,7 @@ namespace Compiler
// store code for if-cascade // store code for if-cascade
Codes codes; Codes codes;
for (IfCodes::reverse_iterator iter (mIfCode.rbegin()); for (auto iter (mIfCode.rbegin());
iter!=mIfCode.rend(); ++iter) iter!=mIfCode.rend(); ++iter)
{ {
Codes block; Codes block;

@ -5,7 +5,7 @@ namespace Compiler
ErrorHandler::ErrorHandler() ErrorHandler::ErrorHandler()
: mWarnings (0), mErrors (0), mWarningsMode (1), mDowngradeErrors (false) {} : mWarnings (0), mErrors (0), mWarningsMode (1), mDowngradeErrors (false) {}
ErrorHandler::~ErrorHandler() {} ErrorHandler::~ErrorHandler() = default;
// Was compiling successful? // Was compiling successful?

@ -83,7 +83,7 @@ namespace Compiler
public: public:
ErrorDowngrade (ErrorHandler& handler); explicit ErrorDowngrade (ErrorHandler& handler);
~ErrorDowngrade(); ~ErrorDowngrade();
}; };

@ -21,7 +21,7 @@ namespace Compiler
{ {
public: public:
const char *what() const noexcept final { return "Can't read file"; } const char *what() const noexcept override { return "Can't read file"; }
///< Return error message ///< Return error message
}; };
@ -31,7 +31,7 @@ namespace Compiler
{ {
public: public:
const char *what() const noexcept final { return "End of file"; } const char *what() const noexcept override { return "End of file"; }
///< Return error message ///< Return error message
}; };
} }

@ -4,8 +4,6 @@
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <stack> #include <stack>
#include <iterator>
#include <sstream>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
@ -21,7 +19,7 @@
namespace Compiler namespace Compiler
{ {
int ExprParser::getPriority (char op) const int ExprParser::getPriority (char op)
{ {
switch (op) switch (op)
{ {
@ -654,28 +652,27 @@ namespace Compiler
std::stack<std::vector<Interpreter::Type_Code> > stack; std::stack<std::vector<Interpreter::Type_Code> > stack;
for (std::string::const_iterator iter (arguments.begin()); iter!=arguments.end(); for (char argument : arguments)
++iter)
{ {
if (*iter=='/') if (argument=='/')
{ {
optional = true; optional = true;
} }
else if (*iter=='S' || *iter=='c' || *iter=='x') else if (argument=='S' || argument=='c' || argument=='x')
{ {
stringParser.reset(); stringParser.reset();
if (optional || *iter=='x') if (optional || argument=='x')
stringParser.setOptional (true); stringParser.setOptional (true);
if (*iter=='c') stringParser.smashCase(); if (argument=='c') stringParser.smashCase();
if (*iter=='x') stringParser.discard(); if (argument=='x') stringParser.discard();
scanner.scan (stringParser); scanner.scan (stringParser);
if ((optional || *iter=='x') && stringParser.isEmpty()) if ((optional || argument=='x') && stringParser.isEmpty())
break; break;
if (*iter!='x') if (argument!='x')
{ {
std::vector<Interpreter::Type_Code> tmp; std::vector<Interpreter::Type_Code> tmp;
stringParser.append (tmp); stringParser.append (tmp);
@ -689,7 +686,7 @@ namespace Compiler
getErrorHandler().warning ("Extra argument", getErrorHandler().warning ("Extra argument",
stringParser.getTokenLoc()); stringParser.getTokenLoc());
} }
else if (*iter=='X') else if (argument=='X')
{ {
parser.reset(); parser.reset();
@ -702,7 +699,7 @@ namespace Compiler
else else
getErrorHandler().warning("Extra argument", parser.getTokenLoc()); getErrorHandler().warning("Extra argument", parser.getTokenLoc());
} }
else if (*iter=='z') else if (argument=='z')
{ {
discardParser.reset(); discardParser.reset();
discardParser.setOptional (true); discardParser.setOptional (true);
@ -714,7 +711,7 @@ namespace Compiler
else else
getErrorHandler().warning("Extra argument", discardParser.getTokenLoc()); getErrorHandler().warning("Extra argument", discardParser.getTokenLoc());
} }
else if (*iter=='j') else if (argument=='j')
{ {
/// \todo disable this when operating in strict mode /// \todo disable this when operating in strict mode
junkParser.reset(); junkParser.reset();
@ -737,8 +734,8 @@ namespace Compiler
char type = parser.append (tmp); char type = parser.append (tmp);
if (type!=*iter) if (type!=argument)
Generator::convert (tmp, type, *iter); Generator::convert (tmp, type, argument);
stack.push (tmp); stack.push (tmp);

@ -28,7 +28,7 @@ namespace Compiler
bool mRefOp; bool mRefOp;
bool mMemberOp; bool mMemberOp;
int getPriority (char op) const; static int getPriority (char op) ;
char getOperandType (int Index = 0) const; char getOperandType (int Index = 0) const;

@ -12,8 +12,7 @@ namespace Compiler
int Extensions::searchKeyword (const std::string& keyword) const int Extensions::searchKeyword (const std::string& keyword) const
{ {
std::map<std::string, int>::const_iterator iter = mKeywords.find (keyword); auto iter = mKeywords.find (keyword);
if (iter==mKeywords.end()) if (iter==mKeywords.end())
return 0; return 0;
@ -23,8 +22,7 @@ namespace Compiler
bool Extensions::isFunction (int keyword, ScriptReturn& returnType, ScriptArgs& argumentType, bool Extensions::isFunction (int keyword, ScriptReturn& returnType, ScriptArgs& argumentType,
bool& explicitReference) const bool& explicitReference) const
{ {
std::map<int, Function>::const_iterator iter = mFunctions.find (keyword); auto iter = mFunctions.find (keyword);
if (iter==mFunctions.end()) if (iter==mFunctions.end())
return false; return false;
@ -39,8 +37,7 @@ namespace Compiler
bool Extensions::isInstruction (int keyword, ScriptArgs& argumentType, bool Extensions::isInstruction (int keyword, ScriptArgs& argumentType,
bool& explicitReference) const bool& explicitReference) const
{ {
std::map<int, Instruction>::const_iterator iter = mInstructions.find (keyword); auto iter = mInstructions.find (keyword);
if (iter==mInstructions.end()) if (iter==mInstructions.end())
return false; return false;
@ -115,8 +112,7 @@ namespace Compiler
{ {
assert (optionalArguments>=0); assert (optionalArguments>=0);
std::map<int, Function>::const_iterator iter = mFunctions.find (keyword); auto iter = mFunctions.find (keyword);
if (iter==mFunctions.end()) if (iter==mFunctions.end())
throw std::logic_error ("unknown custom function keyword"); throw std::logic_error ("unknown custom function keyword");
@ -164,8 +160,7 @@ namespace Compiler
{ {
assert (optionalArguments>=0); assert (optionalArguments>=0);
std::map<int, Instruction>::const_iterator iter = mInstructions.find (keyword); auto iter = mInstructions.find (keyword);
if (iter==mInstructions.end()) if (iter==mInstructions.end())
throw std::logic_error ("unknown custom instruction keyword"); throw std::logic_error ("unknown custom instruction keyword");
@ -209,8 +204,7 @@ namespace Compiler
void Extensions::listKeywords (std::vector<std::string>& keywords) const void Extensions::listKeywords (std::vector<std::string>& keywords) const
{ {
for (std::map<std::string, int>::const_iterator iter (mKeywords.begin()); for (const auto & mKeyword : mKeywords)
iter!=mKeywords.end(); ++iter) keywords.push_back (mKeyword.first);
keywords.push_back (iter->first);
} }
} }

@ -2,7 +2,6 @@
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <iterator>
#include <stdexcept> #include <stdexcept>
#include "literals.hpp" #include "literals.hpp"
@ -283,9 +282,7 @@ namespace
} }
} }
namespace Compiler namespace Compiler::Generator
{
namespace Generator
{ {
void pushInt (CodeContainer& code, Literals& literals, int value) void pushInt (CodeContainer& code, Literals& literals, int value)
{ {
@ -732,4 +729,3 @@ namespace Compiler
} }
} }
} }
}

@ -260,7 +260,7 @@ namespace Compiler
/// \todo add option to disable this /// \todo add option to disable this
std::unique_ptr<ErrorDowngrade> errorDowngrade (nullptr); std::unique_ptr<ErrorDowngrade> errorDowngrade (nullptr);
if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell") if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell")
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); errorDowngrade = std::make_unique<ErrorDowngrade> (getErrorHandler());
std::vector<Interpreter::Type_Code> code; std::vector<Interpreter::Type_Code> code;
int optionals = mExprParser.parseArguments (argumentType, scanner, code, keyword); int optionals = mExprParser.parseArguments (argumentType, scanner, code, keyword);

@ -30,13 +30,11 @@ namespace Compiler
void Literals::append (std::vector<Interpreter::Type_Code>& code) const void Literals::append (std::vector<Interpreter::Type_Code>& code) const
{ {
for (std::vector<Interpreter::Type_Integer>::const_iterator iter (mIntegers.begin()); for (const int & mInteger : mIntegers)
iter!=mIntegers.end(); ++iter) code.push_back (*reinterpret_cast<const Interpreter::Type_Code *> (&mInteger));
code.push_back (*reinterpret_cast<const Interpreter::Type_Code *> (&*iter));
for (std::vector<Interpreter::Type_Float>::const_iterator iter (mFloats.begin()); for (const float & mFloat : mFloats)
iter!=mFloats.end(); ++iter) code.push_back (*reinterpret_cast<const Interpreter::Type_Code *> (&mFloat));
code.push_back (*reinterpret_cast<const Interpreter::Type_Code *> (&*iter));
int stringBlockSize = getStringSize(); int stringBlockSize = getStringSize();
int size = static_cast<int> (code.size()); int size = static_cast<int> (code.size());
@ -45,12 +43,11 @@ namespace Compiler
int offset = 0; int offset = 0;
for (std::vector<std::string>::const_iterator iter (mStrings.begin()); for (const auto & mString : mStrings)
iter!=mStrings.end(); ++iter)
{ {
int stringSize = iter->size()+1; int stringSize = mString.size()+1;
std::copy (iter->c_str(), iter->c_str()+stringSize, std::copy (mString.c_str(), mString.c_str()+stringSize,
reinterpret_cast<char *> (&code[size]) + offset); reinterpret_cast<char *> (&code[size]) + offset);
offset += stringSize; offset += stringSize;
} }

@ -25,8 +25,7 @@ namespace Compiler
{ {
const std::vector<std::string>& collection = get (type); const std::vector<std::string>& collection = get (type);
std::vector<std::string>::const_iterator iter = auto iter = std::find (collection.begin(), collection.end(), name);
std::find (collection.begin(), collection.end(), name);
if (iter==collection.end()) if (iter==collection.end())
return -1; return -1;

@ -1,8 +1,6 @@
#include "opcodes.hpp" #include "opcodes.hpp"
namespace Compiler namespace Compiler::Control
{
namespace Control
{ {
const char *controls[numberOfControls] = const char *controls[numberOfControls] =
{ {
@ -10,4 +8,3 @@ namespace Compiler
"playerviewswitch", "vanitymode" "playerviewswitch", "vanitymode"
}; };
} }
}

@ -2,7 +2,6 @@
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <iterator>
#include "locals.hpp" #include "locals.hpp"

@ -58,7 +58,7 @@ namespace Compiler
// destructor // destructor
Parser::~Parser() {} Parser::~Parser() = default;
// Handle an int token. // Handle an int token.
// \return fetch another token? // \return fetch another token?

@ -1,7 +1,6 @@
#include "scanner.hpp" #include "scanner.hpp"
#include <cassert> #include <cassert>
#include <iterator>
#include "exception.hpp" #include "exception.hpp"
#include "errorhandler.hpp" #include "errorhandler.hpp"
@ -266,7 +265,7 @@ namespace Compiler
"messagebox", "messagebox",
"set", "to", "set", "to",
"getsquareroot", "getsquareroot",
0 nullptr
}; };
bool Scanner::scanName (MultiChar& c, Parser& parser, bool& cont) bool Scanner::scanName (MultiChar& c, Parser& parser, bool& cont)

@ -28,7 +28,7 @@ namespace Compiler
blank(); blank();
} }
MultiChar(const char ch) explicit MultiChar(const char ch)
{ {
blank(); blank();
mData[0] = ch; mData[0] = ch;
@ -36,7 +36,7 @@ namespace Compiler
mLength = getCharLength(ch); mLength = getCharLength(ch);
} }
int getCharLength(const char ch) static int getCharLength(const char ch)
{ {
unsigned char c = ch; unsigned char c = ch;
if (c<=127) return 0; if (c<=127) return 0;
@ -170,8 +170,8 @@ namespace Compiler
} }
private: private:
char mData[4]; char mData[4]{};
int mLength; int mLength{};
}; };
class Scanner class Scanner
@ -251,7 +251,7 @@ namespace Compiler
public: public:
Scanner (ErrorHandler& errorHandler, std::istream& inputStream, Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
const Extensions *extensions = 0); const Extensions *extensions = nullptr);
///< constructor ///< constructor
void scan (Parser& parser); void scan (Parser& parser);

@ -1,7 +1,6 @@
#ifndef COMPILER_SCRIPTPARSER_H_INCLUDED #ifndef COMPILER_SCRIPTPARSER_H_INCLUDED
#define COMPILER_SCRIPTPARSER_H_INCLUDED #define COMPILER_SCRIPTPARSER_H_INCLUDED
#include "parser.hpp" #include "parser.hpp"
#include "lineparser.hpp" #include "lineparser.hpp"
#include "controlparser.hpp" #include "controlparser.hpp"

@ -1,7 +1,5 @@
#include "streamerrorhandler.hpp" #include "streamerrorhandler.hpp"
#include <sstream>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include "tokenloc.hpp" #include "tokenloc.hpp"
@ -61,7 +59,7 @@ namespace Compiler
mContext = context; mContext = context;
} }
StreamErrorHandler::StreamErrorHandler() {} StreamErrorHandler::StreamErrorHandler() = default;
ContextOverride::ContextOverride(StreamErrorHandler& handler, const std::string& context) : mHandler(handler), mContext(handler.mContext) ContextOverride::ContextOverride(StreamErrorHandler& handler, const std::string& context) : mHandler(handler), mContext(handler.mContext)
{ {

@ -1,7 +1,6 @@
#include "stringparser.hpp" #include "stringparser.hpp"
#include <algorithm> #include <algorithm>
#include <iterator>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>

@ -13,7 +13,7 @@ namespace Compiler
int mLine; int mLine;
std::string mLiteral; std::string mLiteral;
TokenLoc() : mColumn (0), mLine (0), mLiteral ("") {} TokenLoc() : mColumn (0), mLine (0), mLiteral () {}
}; };
} }

@ -15,7 +15,7 @@ namespace DetourNavigator
* @brief Navigator constructor initializes all internal data. Constructed object is ready to build a scene. * @brief Navigator constructor initializes all internal data. Constructed object is ready to build a scene.
* @param settings allows to customize navigator work. Constructor is only place to set navigator settings. * @param settings allows to customize navigator work. Constructor is only place to set navigator settings.
*/ */
NavigatorImpl(const Settings& settings); explicit NavigatorImpl(const Settings& settings);
void addAgent(const osg::Vec3f& agentHalfExtents) override; void addAgent(const osg::Vec3f& agentHalfExtents) override;
@ -40,9 +40,9 @@ namespace DetourNavigator
bool removeWater(const osg::Vec2i& cellPosition) override; bool removeWater(const osg::Vec2i& cellPosition) override;
void addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid) final; void addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid) override;
void removePathgrid(const ESM::Pathgrid& pathgrid) final; void removePathgrid(const ESM::Pathgrid& pathgrid) override;
void update(const osg::Vec3f& playerPosition) override; void update(const osg::Vec3f& playerPosition) override;

@ -60,9 +60,9 @@ namespace DetourNavigator
return false; return false;
} }
void addPathgrid(const ESM::Cell& /*cell*/, const ESM::Pathgrid& /*pathgrid*/) final {} void addPathgrid(const ESM::Cell& /*cell*/, const ESM::Pathgrid& /*pathgrid*/) override {}
void removePathgrid(const ESM::Pathgrid& /*pathgrid*/) final {} void removePathgrid(const ESM::Pathgrid& /*pathgrid*/) override {}
void update(const osg::Vec3f& /*playerPosition*/) override {} void update(const osg::Vec3f& /*playerPosition*/) override {}

@ -12,14 +12,14 @@ namespace ESM
{ {
InventoryState mInventory; InventoryState mInventory;
void load (ESMReader &esm) final; void load (ESMReader &esm) override;
void save (ESMWriter &esm, bool inInventory = false) const final; void save (ESMWriter &esm, bool inInventory = false) const override;
ContainerState& asContainerState() final ContainerState& asContainerState() override
{ {
return *this; return *this;
} }
const ContainerState& asContainerState() const final const ContainerState& asContainerState() const override
{ {
return *this; return *this;
} }

@ -12,14 +12,14 @@ namespace ESM
int mSpawnActorId; int mSpawnActorId;
bool mSpawn; bool mSpawn;
void load (ESMReader &esm) final; void load (ESMReader &esm) override;
void save (ESMWriter &esm, bool inInventory = false) const final; void save (ESMWriter &esm, bool inInventory = false) const override;
CreatureLevListState& asCreatureLevListState() final CreatureLevListState& asCreatureLevListState() override
{ {
return *this; return *this;
} }
const CreatureLevListState& asCreatureLevListState() const final const CreatureLevListState& asCreatureLevListState() const override
{ {
return *this; return *this;
} }

@ -15,16 +15,16 @@ namespace ESM
CreatureStats mCreatureStats; CreatureStats mCreatureStats;
/// Initialize to default state /// Initialize to default state
void blank(); void blank() override;
void load (ESMReader &esm) final; void load (ESMReader &esm) override;
void save (ESMWriter &esm, bool inInventory = false) const final; void save (ESMWriter &esm, bool inInventory = false) const override;
CreatureState& asCreatureState() final CreatureState& asCreatureState() override
{ {
return *this; return *this;
} }
const CreatureState& asCreatureState() const final const CreatureState& asCreatureState() const override
{ {
return *this; return *this;
} }

@ -11,14 +11,14 @@ namespace ESM
{ {
int mDoorState = 0; int mDoorState = 0;
void load (ESMReader &esm) final; void load (ESMReader &esm) override;
void save (ESMWriter &esm, bool inInventory = false) const final; void save (ESMWriter &esm, bool inInventory = false) const override;
DoorState& asDoorState() final DoorState& asDoorState() override
{ {
return *this; return *this;
} }
const DoorState& asDoorState() const final const DoorState& asDoorState() const override
{ {
return *this; return *this;
} }

@ -17,16 +17,16 @@ namespace ESM
CreatureStats mCreatureStats; CreatureStats mCreatureStats;
/// Initialize to default state /// Initialize to default state
void blank(); void blank() override;
void load (ESMReader &esm) final; void load (ESMReader &esm) override;
void save (ESMWriter &esm, bool inInventory = false) const final; void save (ESMWriter &esm, bool inInventory = false) const override;
NpcState& asNpcState() final NpcState& asNpcState() override
{ {
return *this; return *this;
} }
const NpcState& asNpcState() const final const NpcState& asNpcState() const override
{ {
return *this; return *this;
} }

@ -49,7 +49,7 @@ namespace ESM
virtual void save (ESMWriter &esm, bool inInventory = false) const; virtual void save (ESMWriter &esm, bool inInventory = false) const;
/// Initialize to default state virtual /// Initialize to default state
void blank(); void blank();
virtual ~ObjectState(); virtual ~ObjectState();

@ -20,9 +20,9 @@ namespace osgMyGUI
MYGUI_RTTI_DERIVED( AdditiveLayer ) MYGUI_RTTI_DERIVED( AdditiveLayer )
AdditiveLayer(); AdditiveLayer();
~AdditiveLayer(); ~AdditiveLayer() override;
void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) final; void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) override;
private: private:
osg::ref_ptr<osg::StateSet> mStateSet; osg::ref_ptr<osg::StateSet> mStateSet;

@ -13,13 +13,13 @@ namespace osgMyGUI
public: public:
MYGUI_RTTI_DERIVED(ScalingLayer) MYGUI_RTTI_DERIVED(ScalingLayer)
void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) final; void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) override;
MyGUI::ILayerItem* getLayerItemByPoint(int _left, int _top) const final; MyGUI::ILayerItem* getLayerItemByPoint(int _left, int _top) const override;
MyGUI::IntPoint getPosition(int _left, int _top) const final; MyGUI::IntPoint getPosition(int _left, int _top) const override;
void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) final; void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) override;
void resizeView(const MyGUI::IntSize& _viewSize) final; void resizeView(const MyGUI::IntSize& _viewSize) override;
private: private:
void screenToLayerCoords(int& _left, int& _top) const; void screenToLayerCoords(int& _left, int& _top) const;

@ -46,11 +46,11 @@ namespace Gui
MYGUI_RTTI_DERIVED( AutoSizedTextBox ) MYGUI_RTTI_DERIVED( AutoSizedTextBox )
public: public:
MyGUI::IntSize getRequestedSize() final; MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) final; void setCaption(const MyGUI::UString& _value) override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
std::string mFontSize; std::string mFontSize;
}; };
@ -60,13 +60,13 @@ namespace Gui
public: public:
MyGUI::IntSize getRequestedSize() final; MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) final; void setCaption(const MyGUI::UString& _value) override;
void initialiseOverride() final; void initialiseOverride() override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
int getWidth(); int getWidth();
std::string mFontSize; std::string mFontSize;
bool mShrink = false; bool mShrink = false;
@ -79,11 +79,11 @@ namespace Gui
MYGUI_RTTI_DERIVED( AutoSizedButton ) MYGUI_RTTI_DERIVED( AutoSizedButton )
public: public:
MyGUI::IntSize getRequestedSize() final; MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) final; void setCaption(const MyGUI::UString& _value) override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
std::string mFontSize; std::string mFontSize;
}; };
@ -118,7 +118,7 @@ namespace Gui
public: public:
Spacer(); Spacer();
MyGUI::IntSize getRequestedSize() final { return MyGUI::IntSize(0,0); } MyGUI::IntSize getRequestedSize() override { return MyGUI::IntSize(0,0); }
}; };
class HBox : public Box, public MyGUI::Widget class HBox : public Box, public MyGUI::Widget
@ -126,18 +126,18 @@ namespace Gui
MYGUI_RTTI_DERIVED( HBox ) MYGUI_RTTI_DERIVED( HBox )
public: public:
void setSize (const MyGUI::IntSize &_value) final; void setSize (const MyGUI::IntSize &_value) override;
void setCoord (const MyGUI::IntCoord &_value) final; void setCoord (const MyGUI::IntCoord &_value) override;
protected: protected:
void initialiseOverride() final; void initialiseOverride() override;
void align() final; void align() override;
MyGUI::IntSize getRequestedSize() final; MyGUI::IntSize getRequestedSize() override;
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
void onWidgetCreated(MyGUI::Widget* _widget) final; void onWidgetCreated(MyGUI::Widget* _widget) override;
}; };
class VBox : public Box, public MyGUI::Widget class VBox : public Box, public MyGUI::Widget
@ -145,18 +145,18 @@ namespace Gui
MYGUI_RTTI_DERIVED( VBox) MYGUI_RTTI_DERIVED( VBox)
public: public:
void setSize (const MyGUI::IntSize &_value) final; void setSize (const MyGUI::IntSize &_value) override;
void setCoord (const MyGUI::IntCoord &_value) final; void setCoord (const MyGUI::IntCoord &_value) override;
protected: protected:
void initialiseOverride() final; void initialiseOverride() override;
void align() final; void align() override;
MyGUI::IntSize getRequestedSize() final; MyGUI::IntSize getRequestedSize() override;
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
void onWidgetCreated(MyGUI::Widget* _widget) final; void onWidgetCreated(MyGUI::Widget* _widget) override;
}; };
} }

@ -31,13 +31,13 @@ namespace Gui
static bool sDefaultNeedKeyFocus; static bool sDefaultNeedKeyFocus;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
void onMouseLostFocus(MyGUI::Widget* _new) final; void onMouseLostFocus(MyGUI::Widget* _new) override;
void onMouseSetFocus(MyGUI::Widget* _old) final; void onMouseSetFocus(MyGUI::Widget* _old) override;
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) final; void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) final; void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) override;
void onKeySetFocus(MyGUI::Widget* _old) final; void onKeySetFocus(MyGUI::Widget* _old) override;
void onKeyLostFocus(MyGUI::Widget* _new) final; void onKeyLostFocus(MyGUI::Widget* _new) override;
std::string mImageHighlighted; std::string mImageHighlighted;
std::string mImageNormal; std::string mImageNormal;

@ -48,10 +48,10 @@ namespace Gui
void scrollToTop(); void scrollToTop();
void setPropertyOverride(const std::string& _key, const std::string& _value) final; void setPropertyOverride(const std::string& _key, const std::string& _value) override;
protected: protected:
void initialiseOverride() final; void initialiseOverride() override;
void redraw(bool scrollbarShown = false); void redraw(bool scrollbarShown = false);

@ -22,8 +22,8 @@ namespace Gui
{ {
} }
void initialiseOverride() final; void initialiseOverride() override;
void shutdownOverride() final; void shutdownOverride() override;
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_ValueChanged; typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_ValueChanged;
EventHandle_ValueChanged eventValueChanged; EventHandle_ValueChanged eventValueChanged;
@ -36,8 +36,8 @@ namespace Gui
void setMaxValue(int maxValue); void setMaxValue(int maxValue);
private: private:
void onEditTextChange(MyGUI::EditBox* sender); void onEditTextChange(MyGUI::EditBox* sender);
void onKeyLostFocus(MyGUI::Widget* _new) final; void onKeyLostFocus(MyGUI::Widget* _new) override;
void onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character) final; void onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character) override;
int mValue; int mValue;

@ -23,13 +23,13 @@ namespace Gui
protected: protected:
void updateButtonState(); void updateButtonState();
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) final; void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) final; void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseSetFocus(MyGUI::Widget* _old) final; void onMouseSetFocus(MyGUI::Widget* _old) override;
void onMouseLostFocus(MyGUI::Widget* _new) final; void onMouseLostFocus(MyGUI::Widget* _new) override;
void baseUpdateEnable() final; void baseUpdateEnable() override;
void shutdownOverride() final; void shutdownOverride() override;
bool _setState(const std::string &_value); bool _setState(const std::string &_value);

@ -14,11 +14,11 @@ namespace Gui
public: public:
WindowCaption(); WindowCaption();
void setCaption(const MyGUI::UString &_value) final; void setCaption(const MyGUI::UString &_value) override;
void initialiseOverride() final; void initialiseOverride() override;
void setSize(const MyGUI::IntSize& _value) final; void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) final; void setCoord(const MyGUI::IntCoord& _value) override;
private: private:
MyGUI::Widget* mLeft; MyGUI::Widget* mLeft;

Loading…
Cancel
Save