Issue #370: replaced custom target handling in read action with base class implementation

This commit is contained in:
Marc Zinnschlag 2012-09-04 15:24:55 +02:00
parent 3f181f9a9d
commit b51c42146f
2 changed files with 4 additions and 6 deletions

View file

@ -8,23 +8,23 @@
namespace MWWorld namespace MWWorld
{ {
ActionRead::ActionRead (const MWWorld::Ptr& object) : mObject (object) ActionRead::ActionRead (const MWWorld::Ptr& object) : Action (false, object)
{ {
} }
void ActionRead::executeImp (const MWWorld::Ptr& actor) void ActionRead::executeImp (const MWWorld::Ptr& actor)
{ {
LiveCellRef<ESM::Book> *ref = mObject.get<ESM::Book>(); LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
if (ref->base->data.isScroll) if (ref->base->data.isScroll)
{ {
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(mObject); MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(getTarget());
} }
else else
{ {
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book);
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(mObject); MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget());
} }
} }
} }

View file

@ -8,8 +8,6 @@ namespace MWWorld
{ {
class ActionRead : public Action class ActionRead : public Action
{ {
Ptr mObject; // book or scroll to read
virtual void executeImp (const MWWorld::Ptr& actor); virtual void executeImp (const MWWorld::Ptr& actor);
public: public: