mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 12:42:11 +00:00
31 lines
895 B
C++
31 lines
895 B
C++
#include "actionread.hpp"
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
#include "../mwbase/windowmanager.hpp"
|
|
|
|
#include "../mwgui/bookwindow.hpp"
|
|
#include "../mwgui/scrollwindow.hpp"
|
|
|
|
namespace MWWorld
|
|
{
|
|
ActionRead::ActionRead (const MWWorld::Ptr& object) : Action (false, object)
|
|
{
|
|
}
|
|
|
|
void ActionRead::executeImp (const MWWorld::Ptr& actor)
|
|
{
|
|
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
|
|
|
|
if (ref->base->data.isScroll)
|
|
{
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
|
|
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(getTarget());
|
|
}
|
|
else
|
|
{
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book);
|
|
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget());
|
|
}
|
|
}
|
|
}
|