From 844cbc5a145e4db2683ba8f601da23b953467104 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 11 Jun 2016 17:46:30 +0200 Subject: [PATCH] Add isNullAction() method to fix compiler warning --- apps/openmw/mwgui/sortfilteritemmodel.cpp | 9 ++++++--- apps/openmw/mwworld/action.hpp | 3 +++ apps/openmw/mwworld/nullaction.hpp | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index 1d086f2ee..9c73db340 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -132,9 +132,12 @@ namespace MWGui && !base.get()->mBase->mData.mIsScroll) return false; - if ((mFilter & Filter_OnlyUsableItems) && typeid(*base.getClass().use(base)) == typeid(MWWorld::NullAction) - && base.getClass().getScript(base).empty()) - return false; + if ((mFilter & Filter_OnlyUsableItems) && base.getClass().getScript(base).empty()) + { + boost::shared_ptr actionOnUse = base.getClass().use(base); + if (!actionOnUse || actionOnUse->isNullAction()) + return false; + } return true; } diff --git a/apps/openmw/mwworld/action.hpp b/apps/openmw/mwworld/action.hpp index 3e0e8ad1b..38907cf44 100644 --- a/apps/openmw/mwworld/action.hpp +++ b/apps/openmw/mwworld/action.hpp @@ -32,6 +32,9 @@ namespace MWWorld virtual ~Action(); + virtual bool isNullAction() { return false; } + ///< Is running this action a no-op? (default false) + void execute (const Ptr& actor); void setSound (const std::string& id); diff --git a/apps/openmw/mwworld/nullaction.hpp b/apps/openmw/mwworld/nullaction.hpp index 7ef8b4a06..5461d8711 100644 --- a/apps/openmw/mwworld/nullaction.hpp +++ b/apps/openmw/mwworld/nullaction.hpp @@ -9,6 +9,8 @@ namespace MWWorld class NullAction : public Action { virtual void executeImp (const Ptr& actor) {} + + virtual bool isNullAction() { return true; } }; }