Merge branch 'cleanup_1' into 'master'

Cleanup 1

See merge request OpenMW/openmw!365
pull/3022/head
psi29a 4 years ago
commit 957a1425d1

@ -59,38 +59,38 @@ namespace CSVRender
/// Editmode for terrain shape grid
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
void primaryEditPressed (const WorldspaceHitResult& hit) final;
void primaryEditPressed (const WorldspaceHitResult& hit) override;
/// 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 deactivate(CSVWidget::SceneToolbar*) final;
void activate(CSVWidget::SceneToolbar*) override;
void deactivate(CSVWidget::SceneToolbar*) override;
/// Start shape editing command macro
bool primaryEditStartDrag (const QPoint& pos) final;
bool primaryEditStartDrag (const QPoint& pos) override;
bool secondaryEditStartDrag (const QPoint& pos) final;
bool primarySelectStartDrag (const QPoint& pos) final;
bool secondarySelectStartDrag (const QPoint& pos) final;
bool secondaryEditStartDrag (const QPoint& pos) override;
bool primarySelectStartDrag (const QPoint& pos) override;
bool secondarySelectStartDrag (const QPoint& pos) override;
/// 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
void dragCompleted(const QPoint& pos) final;
void dragCompleted(const QPoint& pos) override;
/// Cancel shape editing, and reset all pending changes
void dragAborted() final;
void dragAborted() override;
void dragWheel (int diff, double speedFactor) final;
void dragMoveEvent (QDragMoveEvent *event) final;
void mouseMoveEvent (QMouseEvent *event) final;
void dragWheel (int diff, double speedFactor) override;
void dragMoveEvent (QDragMoveEvent *event) override;
void mouseMoveEvent (QMouseEvent *event) override;
private:

@ -27,10 +27,10 @@ namespace CSVRender
const CSMWorld::Data& mData;
std::array<float, ESM::Land::LAND_SIZE * ESM::Land::LAND_SIZE> mAlteredHeight;
osg::ref_ptr<const ESMTerrain::LandObject> getLand (int cellX, int cellY) final;
const ESM::LandTexture* getLandTexture(int index, short plugin) final;
osg::ref_ptr<const ESMTerrain::LandObject> getLand (int cellX, int cellY) override;
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 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 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;
float getAlteredHeight(int col, int row) 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 override;
};
}

@ -53,37 +53,37 @@ namespace CSVRender
/// \brief Editmode for terrain texture grid
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
void primaryEditPressed (const WorldspaceHitResult& hit) final;
void primaryEditPressed (const WorldspaceHitResult& hit) override;
/// \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 deactivate(CSVWidget::SceneToolbar*) final;
void activate(CSVWidget::SceneToolbar*) override;
void deactivate(CSVWidget::SceneToolbar*) override;
/// \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 primarySelectStartDrag (const QPoint& pos) final;
bool secondarySelectStartDrag (const QPoint& pos) final;
bool secondaryEditStartDrag (const QPoint& pos) override;
bool primarySelectStartDrag (const QPoint& pos) override;
bool secondarySelectStartDrag (const QPoint& pos) override;
/// \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
void dragCompleted(const QPoint& pos) final;
void dragCompleted(const QPoint& pos) override;
void dragAborted() final;
void dragWheel (int diff, double speedFactor) final;
void dragMoveEvent (QDragMoveEvent *event) final;
void dragAborted() override;
void dragWheel (int diff, double speedFactor) override;
void dragMoveEvent (QDragMoveEvent *event) override;
void mouseMoveEvent (QMouseEvent *event) final;
void mouseMoveEvent (QMouseEvent *event) override;
private:
/// \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;
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;
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;
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;

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

@ -1152,7 +1152,7 @@ public:
i->second->createDrawItem (mNode);
}
void setVisible (bool newVisible) final
void setVisible (bool newVisible) override
{
if (mVisible == newVisible)
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;
@ -1242,9 +1242,9 @@ public:
// ISubWidget should not necessarily be a drawitem
// in this case, it is not...
void doRender() final { }
void doRender() override { }
void _updateView () final
void _updateView () override
{
_checkMargin();
@ -1253,7 +1253,7 @@ public:
mNode->outOfDate (i->second->mRenderItem);
}
void _correctView() final
void _correctView() override
{
_checkMargin ();
@ -1263,7 +1263,7 @@ public:
}
void destroyDrawItem() final
void destroyDrawItem() override
{
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
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);
}
void adviseLinkClicked (std::function <void (InteractiveId)> linkClicked) final
void adviseLinkClicked (std::function <void (InteractiveId)> linkClicked) override
{
mPageDisplay->mLinkClicked = linkClicked;
}
void unadviseLinkClicked () final
void unadviseLinkClicked () override
{
mPageDisplay->mLinkClicked = std::function <void (InteractiveId)> ();
}
protected:
void initialiseOverride() final
void initialiseOverride() override
{
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).
// Child widgets may already be destroyed! So be careful.
mPageDisplay->onMouseLostFocus ();
}
void onMouseMove(int left, int top) final
void onMouseMove(int left, int top) override
{
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);
}
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);
}

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

@ -20,10 +20,10 @@ namespace MWGui
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 setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point) final;
void setImage(MyGUI::ImageBox* _image) override;
void setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point) override;
//and now for the whole point of this class, allow us to get
//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
static void registerComponents();
void initialiseOverride() final;
void initialiseOverride() override;
/// Takes ownership of \a model
void setModel(ItemModel* model);
@ -47,8 +47,8 @@ namespace MWGui
void layoutWidgets();
void resetScrollbars();
void setSize(const MyGUI::IntSize& value) final;
void setCoord(const MyGUI::IntCoord& value) final;
void setSize(const MyGUI::IntSize& value) override;
void setCoord(const MyGUI::IntCoord& value) override;
MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, const MWWorld::Ptr&> eventItemClicked;

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

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

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

@ -10,7 +10,7 @@ namespace MWGui
MYGUI_RTTI_DERIVED( AutoSizedResourceSkin )
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
EventHandle_ModelIndex eventSpellClicked;
void initialiseOverride() final;
void initialiseOverride() override;
void setSize(const MyGUI::IntSize& _value) final;
void setCoord(const MyGUI::IntCoord& _value) final;
void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) override;
void resetScrollbars();

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

@ -24,15 +24,15 @@ namespace MWMechanics
public:
/// Constructor
/** \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; }
void writeState(ESM::AiSequence::AiSequence& sequence) const final;
void writeState(ESM::AiSequence::AiSequence& sequence) const override;
private:
const std::string mObjectId;

@ -20,9 +20,9 @@ namespace MWMechanics
{
public:
/// 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; }

@ -10,7 +10,7 @@ namespace MWMechanics
class AiBreathe final : public TypedAiPackage<AiBreathe>
{
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; }

@ -15,11 +15,11 @@ namespace MWMechanics
public:
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; }
MWWorld::Ptr getTarget() const final;
MWWorld::Ptr getTarget() const override;
static constexpr Options makeDefaultOptions()
{

@ -96,13 +96,13 @@ namespace MWMechanics
public:
///Constructor
/** \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();
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; }
@ -116,9 +116,9 @@ namespace MWMechanics
}
///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:
/// Returns true if combat should end

@ -30,7 +30,7 @@ namespace MWMechanics
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; }
@ -42,11 +42,11 @@ namespace MWMechanics
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:
const std::string mCellId;

@ -10,7 +10,7 @@ namespace MWMechanics
public:
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; }

@ -53,7 +53,7 @@ namespace MWMechanics
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; }
@ -69,15 +69,15 @@ namespace MWMechanics
/// Returns the actor being followed
std::string getFollowedActor();
void writeState (ESM::AiSequence::AiSequence& sequence) const final;
void writeState (ESM::AiSequence::AiSequence& sequence) const override;
bool isCommanded() 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();
if (target.isEmpty())

@ -26,7 +26,7 @@ namespace MWMechanics
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; }
@ -38,9 +38,9 @@ namespace MWMechanics
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

@ -25,14 +25,14 @@ namespace MWMechanics
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
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; }
@ -44,7 +44,7 @@ namespace MWMechanics
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:
const float mX;
@ -62,7 +62,7 @@ namespace MWMechanics
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 **/
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; }
@ -103,13 +103,13 @@ namespace MWMechanics
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)
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)
return false;

@ -156,17 +156,17 @@ namespace MWPhysics
/// 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.
/// \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.
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>(),
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.
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);

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

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

@ -22,7 +22,7 @@ struct ContentFileTest : public ::testing::Test
{
protected:
virtual void SetUp()
void SetUp() override
{
readContentFiles();
@ -31,13 +31,13 @@ struct ContentFileTest : public ::testing::Test
readerList.resize(mContentFiles.size());
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;
lEsm.setEncoder(nullptr);
lEsm.setIndex(index);
lEsm.setGlobalReaderList(&readerList);
lEsm.open(it->string());
lEsm.open(mContentFile.string());
readerList[index] = lEsm;
mEsmStore.load(readerList[index], &dummyListener);
@ -47,7 +47,7 @@ struct ContentFileTest : public ::testing::Test
mEsmStore.setUp();
}
virtual void TearDown()
void TearDown() override
{
}
@ -86,8 +86,8 @@ struct ContentFileTest : public ::testing::Test
Files::Collections collections (dataDirs, true);
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)
mContentFiles.push_back(collections.getPath(*it));
for (auto & contentFile : contentFiles)
mContentFiles.push_back(collections.getPath(contentFile));
}
protected:
@ -111,14 +111,12 @@ TEST_F(ContentFileTest, dialogue_merging_test)
stream.open(file);
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;
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 << std::endl;
@ -229,7 +227,7 @@ template <typename T>
Files::IStreamPtr getEsmFile(T record, bool deleted)
{
ESM::ESMWriter writer;
std::stringstream* stream = new std::stringstream;
auto* stream = new std::stringstream;
writer.setFormat(0);
writer.save(*stream);
writer.startRecord(T::sRecordId);

@ -150,7 +150,7 @@ void BSAFile::readHeader()
/// Get the index of a given file name, or -1 if not found
int BSAFile::getIndex(const char *str) const
{
Lookup::const_iterator it = mLookup.find(str);
auto it = mLookup.find(str);
if(it == mLookup.end())
return -1;

@ -24,7 +24,7 @@
#ifndef BSA_BSA_FILE_H
#define BSA_BSA_FILE_H
#include <stdint.h>
#include <cstdint>
#include <string>
#include <vector>
#include <map>
@ -106,8 +106,7 @@ public:
: mIsLoaded(false)
{ }
virtual ~BSAFile()
{ }
virtual ~BSAFile() = default;
/// Open an archive file.
void open(const std::string &file);

@ -36,7 +36,6 @@
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/array.hpp>
#include <components/bsa/memorystream.hpp>
@ -103,8 +102,7 @@ CompressedBSAFile::CompressedBSAFile()
: mCompressedByDefault(false), mEmbeddedFileNames(false)
{ }
CompressedBSAFile::~CompressedBSAFile()
{ }
CompressedBSAFile::~CompressedBSAFile() = default;
/// Read header information from the input source
void CompressedBSAFile::readHeader()
@ -183,7 +181,7 @@ void CompressedBSAFile::readHeader()
else
input.read(reinterpret_cast<char*>(&fr.offset), 4); // not sure purpose of offset
std::map<std::uint64_t, FolderRecord>::const_iterator lb = mFolders.lower_bound(hash);
auto lb = mFolders.lower_bound(hash);
if (lb != mFolders.end() && !(mFolders.key_comp()(hash, lb->first)))
fail("Archive found duplicate folder name hash");
else
@ -194,7 +192,7 @@ void CompressedBSAFile::readHeader()
std::uint64_t fileHash;
FileRecord file;
std::string folder("");
std::string folder;
std::uint64_t folderHash;
if ((archiveFlags & 0x1) == 0)
folderCount = 1; // TODO: not tested - unit test necessary
@ -209,7 +207,7 @@ void CompressedBSAFile::readHeader()
folderHash = generateHash(folder, std::string());
std::map<std::uint64_t, FolderRecord>::iterator iter = mFolders.find(folderHash);
auto iter = mFolders.find(folderHash);
if (iter == mFolders.end())
fail("Archive folder name hash not found");
@ -219,13 +217,13 @@ void CompressedBSAFile::readHeader()
input.read(reinterpret_cast<char*>(&file.size), 4);
input.read(reinterpret_cast<char*>(&file.offset), 4);
std::map<std::uint64_t, FileRecord>::const_iterator lb = iter->second.files.lower_bound(fileHash);
auto lb = iter->second.files.lower_bound(fileHash);
if (lb != iter->second.files.end() && !(iter->second.files.key_comp()(fileHash, lb->first)))
fail("Archive found duplicate file name hash");
iter->second.files.insert(lb, std::pair<std::uint64_t, FileRecord>(fileHash, file));
FileStruct fileStruct;
FileStruct fileStruct{};
fileStruct.fileSize = file.getSizeWithoutCompressionFlag();
fileStruct.offset = file.offset;
fileStruct.name = nullptr;
@ -308,12 +306,12 @@ CompressedBSAFile::FileRecord CompressedBSAFile::getFileRecord(const std::string
std::string folder = p.string();
std::uint64_t folderHash = generateHash(folder, std::string());
std::map<std::uint64_t, FolderRecord>::const_iterator it = mFolders.find(folderHash);
auto it = mFolders.find(folderHash);
if (it == mFolders.end())
return FileRecord(); // folder not found, return default which has offset of sInvalidOffset
std::uint64_t fileHash = generateHash(stem, ext);
std::map<std::uint64_t, FileRecord>::const_iterator iter = it->second.files.find(fileHash);
auto iter = it->second.files.find(fileHash);
if (iter == it->second.files.end())
return FileRecord(); // file not found, return default which has offset of sInvalidOffset
@ -430,12 +428,12 @@ BsaVersion CompressedBSAFile::detectVersion(std::string filePath)
//mFiles used by OpenMW expects uncompressed sizes
void CompressedBSAFile::convertCompressedSizesToUncompressed()
{
for (auto iter = mFiles.begin(); iter != mFiles.end(); ++iter)
for (auto & mFile : mFiles)
{
const FileRecord& fileRecord = getFileRecord(iter->name);
const FileRecord& fileRecord = getFileRecord(mFile.name);
if (!fileRecord.isValid())
{
fail("Could not find file " + std::string(iter->name) + " in BSA");
fail("Could not find file " + std::string(mFile.name) + " in BSA");
}
if (!fileRecord.isCompressed(mCompressedByDefault))
@ -452,11 +450,11 @@ void CompressedBSAFile::convertCompressedSizesToUncompressed()
getBZString(embeddedFileName, *(dataBegin.get()));
}
dataBegin->read(reinterpret_cast<char*>(&(iter->fileSize)), sizeof(iter->fileSize));
dataBegin->read(reinterpret_cast<char*>(&(mFile.fileSize)), sizeof(mFile.fileSize));
}
}
std::uint64_t CompressedBSAFile::generateHash(std::string stem, std::string extension) const
std::uint64_t CompressedBSAFile::generateHash(std::string stem, std::string extension)
{
size_t len = stem.length();
if (len == 0)

@ -80,7 +80,7 @@ namespace Bsa
//mFiles used by OpenMW will contain uncompressed file sizes
void convertCompressedSizesToUncompressed();
/// \brief Normalizes given filename or folder and generates format-compatible hash. See https://en.uesp.net/wiki/Tes4Mod:Hash_Calculation.
std::uint64_t generateHash(std::string stem, std::string extension) const;
static std::uint64_t generateHash(std::string stem, std::string extension) ;
Files::IStreamPtr getFile(const FileRecord& fileRecord);
public:
CompressedBSAFile();

@ -37,8 +37,8 @@ Class used internally by MemoryInputStream.
class MemoryInputStreamBuf : public std::streambuf {
public:
MemoryInputStreamBuf(size_t bufferSize);
char* getRawData();
explicit MemoryInputStreamBuf(size_t bufferSize);
virtual char* getRawData();
private:
//correct call to delete [] on C++ 11
std::vector<char> mBufferPtr;
@ -54,8 +54,8 @@ private:
*/
class MemoryInputStream : virtual MemoryInputStreamBuf, std::istream {
public:
MemoryInputStream(size_t bufferSize);
char* getRawData();
explicit MemoryInputStream(size_t bufferSize);
char* getRawData() override;
};
}

@ -11,11 +11,11 @@ namespace BulletHelpers
class ProcessTriangleCallback : public btTriangleCallback
{
public:
ProcessTriangleCallback(Impl impl)
explicit ProcessTriangleCallback(Impl impl)
: mImpl(std::move(impl))
{}
void processTriangle(btVector3* triangle, int partId, int triangleIndex) final
void processTriangle(btVector3* triangle, int partId, int triangleIndex) override
{
return mImpl(triangle, partId, triangleIndex);
}

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

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

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

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

@ -21,7 +21,7 @@ namespace Compiler
{
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
};
@ -31,7 +31,7 @@ namespace Compiler
{
public:
const char *what() const noexcept final { return "End of file"; }
const char *what() const noexcept override { return "End of file"; }
///< Return error message
};
}

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

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

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

@ -2,7 +2,6 @@
#include <cassert>
#include <algorithm>
#include <iterator>
#include <stdexcept>
#include "literals.hpp"
@ -283,9 +282,7 @@ namespace
}
}
namespace Compiler
{
namespace Generator
namespace Compiler::Generator
{
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
std::unique_ptr<ErrorDowngrade> errorDowngrade (nullptr);
if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell")
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler()));
errorDowngrade = std::make_unique<ErrorDowngrade> (getErrorHandler());
std::vector<Interpreter::Type_Code> code;
int optionals = mExprParser.parseArguments (argumentType, scanner, code, keyword);

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

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

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

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

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

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

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

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

@ -61,7 +61,7 @@ namespace Compiler
mContext = context;
}
StreamErrorHandler::StreamErrorHandler() {}
StreamErrorHandler::StreamErrorHandler() = default;
ContextOverride::ContextOverride(StreamErrorHandler& handler, const std::string& context) : mHandler(handler), mContext(handler.mContext)
{

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

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

@ -7,24 +7,6 @@
#include <components/files/configurationmanager.hpp>
#include <boost/version.hpp>
/**
* Workaround for problems with whitespaces in paths in older versions of Boost library
*/
#if (BOOST_VERSION <= 104600)
namespace boost
{
template<>
inline boost::filesystem::path lexical_cast<boost::filesystem::path, std::string>(const std::string& arg)
{
return boost::filesystem::path(arg);
}
} /* namespace boost */
#endif /* (BOOST_VERSION <= 104600) */
const char Config::GameSettings::sContentKey[] = "content";
Config::GameSettings::GameSettings(Files::ConfigurationManager &cfg)
@ -32,9 +14,7 @@ Config::GameSettings::GameSettings(Files::ConfigurationManager &cfg)
{
}
Config::GameSettings::~GameSettings()
{
}
Config::GameSettings::~GameSettings() = default;
void Config::GameSettings::validatePaths()
{
@ -51,8 +31,8 @@ void Config::GameSettings::validatePaths()
mCfgMgr.processPaths(dataDirs);
mDataDirs.clear();
for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) {
QString path = QString::fromUtf8(it->string().c_str());
for (auto & dataDir : dataDirs) {
QString path = QString::fromUtf8(dataDir.string().c_str());
QDir dir(path);
if (dir.exists())
@ -196,11 +176,11 @@ bool Config::GameSettings::writeFile(QTextStream &stream)
QString string = i.value();
stream << delim;
for (QString::const_iterator it = string.begin(); it != string.end(); ++it)
for (auto it : string)
{
if (*it == delim || *it == escape)
if (it == delim || it == escape)
stream << escape;
stream << *it;
stream << it;
}
stream << delim;
@ -215,7 +195,7 @@ bool Config::GameSettings::writeFile(QTextStream &stream)
return true;
}
bool Config::GameSettings::isOrderedLine(const QString& line) const
bool Config::GameSettings::isOrderedLine(const QString& line)
{
return line.contains(QRegExp("^\\s*fallback-archive\\s*="))
|| line.contains(QRegExp("^\\s*fallback\\s*="))
@ -283,9 +263,9 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
//
QRegExp settingRegex("^([^=]+)\\s*=\\s*([^,]+)(.*)$");
std::vector<QString> comments;
std::vector<QString>::iterator commentStart = fileCopy.end();
auto commentStart = fileCopy.end();
std::map<QString, std::vector<QString> > commentsMap;
for (std::vector<QString>::iterator iter = fileCopy.begin(); iter != fileCopy.end(); ++iter)
for (auto iter = fileCopy.begin(); iter != fileCopy.end(); ++iter)
{
if (isOrderedLine(*iter))
{
@ -335,9 +315,9 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
if (commentStart == fileCopy.end())
throw std::runtime_error("Config::GameSettings: failed to parse settings - iterator is past of end of settings file");
for (std::vector<QString>::const_iterator it = comments.begin(); it != comments.end(); ++it)
for (const auto & comment : comments)
{
*commentStart = *it;
*commentStart = comment;
++commentStart;
}
comments.clear();
@ -379,16 +359,16 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
}
// comments at top of file
for (std::vector<QString>::iterator iter = fileCopy.begin(); iter != fileCopy.end(); ++iter)
for (auto & iter : fileCopy)
{
if ((*iter).isNull())
if (iter.isNull())
continue;
// Below is based on readFile() code, if that changes corresponding change may be
// required (for example duplicates may be inserted if the rules don't match)
if (/*(*iter).isEmpty() ||*/ (*iter).contains(QRegExp("^\\s*#")))
if (/*(*iter).isEmpty() ||*/ iter.contains(QRegExp("^\\s*#")))
{
stream << *iter << "\n";
stream << iter << "\n";
continue;
}
}
@ -415,11 +395,11 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
QString string = it.value();
settingLine += delim;
for (QString::const_iterator iter = string.begin(); iter != string.end(); ++iter)
for (auto iter : string)
{
if (*iter == delim || *iter == escape)
if (iter == delim || iter == escape)
settingLine += escape;
settingLine += *iter;
settingLine += iter;
}
settingLine += delim;
}
@ -428,8 +408,7 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
if (settingRegex.indexIn(settingLine) != -1)
{
std::map<QString, std::vector<QString> >::iterator i =
commentsMap.find(settingRegex.cap(1)+"="+settingRegex.cap(2));
auto i = commentsMap.find(settingRegex.cap(1)+"="+settingRegex.cap(2));
// check if previous removed content item with comments
if (i == commentsMap.end())
@ -438,8 +417,8 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
if (i != commentsMap.end())
{
std::vector<QString> cLines = i->second;
for (std::vector<QString>::const_iterator ci = cLines.begin(); ci != cLines.end(); ++ci)
stream << *ci << "\n";
for (const auto & cLine : cLines)
stream << cLine << "\n";
commentsMap.erase(i);
}
@ -451,14 +430,14 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
// flush any removed settings
if (!commentsMap.empty())
{
std::map<QString, std::vector<QString> >::const_iterator i = commentsMap.begin();
auto i = commentsMap.begin();
for (; i != commentsMap.end(); ++i)
{
if (i->first.contains(QRegExp("^\\s*content\\s*=")))
{
std::vector<QString> cLines = i->second;
for (std::vector<QString>::const_iterator ci = cLines.begin(); ci != cLines.end(); ++ci)
stream << *ci << "\n";
for (const auto & cLine : cLines)
stream << cLine << "\n";
// mark the content line entry for future preocessing
stream << "##" << i->first << "\n";
@ -471,8 +450,8 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
// flush any end comments
if (!comments.empty())
{
for (std::vector<QString>::const_iterator ci = comments.begin(); ci != comments.end(); ++ci)
stream << *ci << "\n";
for (const auto & comment : comments)
stream << comment << "\n";
}
file.resize(file.pos());

@ -88,7 +88,7 @@ namespace Config
static const char sContentKey[];
bool isOrderedLine(const QString& line) const;
static bool isOrderedLine(const QString& line) ;
};
}
#endif // GAMESETTINGS_HPP

@ -12,13 +12,9 @@ const char Config::LauncherSettings::sLauncherConfigFileName[] = "launcher.cfg";
const char Config::LauncherSettings::sContentListsSectionPrefix[] = "Profiles/";
const char Config::LauncherSettings::sContentListSuffix[] = "/content";
Config::LauncherSettings::LauncherSettings()
{
}
Config::LauncherSettings::LauncherSettings() = default;
Config::LauncherSettings::~LauncherSettings()
{
}
Config::LauncherSettings::~LauncherSettings() = default;
QStringList Config::LauncherSettings::subKeys(const QString &key)
{

@ -15,7 +15,7 @@ namespace Config
public:
SettingsBase() { mMultiValue = false; }
~SettingsBase() {}
~SettingsBase() = default;
inline QString value(const QString &key, const QString &defaultValue = QString()) const
{

@ -15,7 +15,7 @@ namespace DetourNavigator
* @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.
*/
NavigatorImpl(const Settings& settings);
explicit NavigatorImpl(const Settings& settings);
void addAgent(const osg::Vec3f& agentHalfExtents) override;
@ -40,9 +40,9 @@ namespace DetourNavigator
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;

@ -60,9 +60,9 @@ namespace DetourNavigator
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 {}

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

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

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

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

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

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

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

@ -13,13 +13,13 @@ namespace osgMyGUI
public:
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::IntPoint getPosition(int _left, int _top) const final;
void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) final;
MyGUI::ILayerItem* getLayerItemByPoint(int _left, int _top) const override;
MyGUI::IntPoint getPosition(int _left, int _top) const override;
void renderToTarget(MyGUI::IRenderTarget* _target, bool _update) override;
void resizeView(const MyGUI::IntSize& _viewSize) final;
void resizeView(const MyGUI::IntSize& _viewSize) override;
private:
void screenToLayerCoords(int& _left, int& _top) const;

@ -46,11 +46,11 @@ namespace Gui
MYGUI_RTTI_DERIVED( AutoSizedTextBox )
public:
MyGUI::IntSize getRequestedSize() final;
void setCaption(const MyGUI::UString& _value) final;
MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) override;
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;
};
@ -60,13 +60,13 @@ namespace Gui
public:
MyGUI::IntSize getRequestedSize() final;
void setCaption(const MyGUI::UString& _value) final;
MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) override;
void initialiseOverride() final;
void initialiseOverride() override;
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();
std::string mFontSize;
bool mShrink = false;
@ -79,11 +79,11 @@ namespace Gui
MYGUI_RTTI_DERIVED( AutoSizedButton )
public:
MyGUI::IntSize getRequestedSize() final;
void setCaption(const MyGUI::UString& _value) final;
MyGUI::IntSize getRequestedSize() override;
void setCaption(const MyGUI::UString& _value) override;
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;
};
@ -118,7 +118,7 @@ namespace Gui
public:
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
@ -126,18 +126,18 @@ namespace Gui
MYGUI_RTTI_DERIVED( HBox )
public:
void setSize (const MyGUI::IntSize &_value) final;
void setCoord (const MyGUI::IntCoord &_value) final;
void setSize (const MyGUI::IntSize &_value) override;
void setCoord (const MyGUI::IntCoord &_value) override;
protected:
void initialiseOverride() final;
void initialiseOverride() override;
void align() final;
MyGUI::IntSize getRequestedSize() final;
void align() override;
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
@ -145,18 +145,18 @@ namespace Gui
MYGUI_RTTI_DERIVED( VBox)
public:
void setSize (const MyGUI::IntSize &_value) final;
void setCoord (const MyGUI::IntCoord &_value) final;
void setSize (const MyGUI::IntSize &_value) override;
void setCoord (const MyGUI::IntCoord &_value) override;
protected:
void initialiseOverride() final;
void initialiseOverride() override;
void align() final;
MyGUI::IntSize getRequestedSize() final;
void align() override;
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;
protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) final;
void onMouseLostFocus(MyGUI::Widget* _new) final;
void onMouseSetFocus(MyGUI::Widget* _old) final;
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) final;
void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) final;
void onKeySetFocus(MyGUI::Widget* _old) final;
void onKeyLostFocus(MyGUI::Widget* _new) final;
void setPropertyOverride(const std::string& _key, const std::string& _value) override;
void onMouseLostFocus(MyGUI::Widget* _new) override;
void onMouseSetFocus(MyGUI::Widget* _old) override;
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) override;
void onKeySetFocus(MyGUI::Widget* _old) override;
void onKeyLostFocus(MyGUI::Widget* _new) override;
std::string mImageHighlighted;
std::string mImageNormal;

@ -48,10 +48,10 @@ namespace Gui
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:
void initialiseOverride() final;
void initialiseOverride() override;
void redraw(bool scrollbarShown = false);

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

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

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

Loading…
Cancel
Save