mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-02 02:45:32 +00:00
Merge remote-tracking branch 'zini/next' into animation2
This commit is contained in:
commit
bea460955d
64 changed files with 676 additions and 124 deletions
|
@ -59,7 +59,7 @@ opencs_units (view/world
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units_noqt (view/world
|
opencs_units_noqt (view/world
|
||||||
dialoguesubview util subviews
|
dialoguesubview util subviews enumdelegate vartypedelegate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ opencs_units_noqt (view/tools
|
||||||
set (OPENCS_US
|
set (OPENCS_US
|
||||||
)
|
)
|
||||||
|
|
||||||
set (OPENCS_RES
|
set (OPENCS_RES ../../files/opencs/resources.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
class Application : public QApplication
|
class Application : public QApplication
|
||||||
{
|
{
|
||||||
|
@ -31,8 +32,11 @@ class Application : public QApplication
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Q_INIT_RESOURCE (resources);
|
||||||
Application mApplication (argc, argv);
|
Application mApplication (argc, argv);
|
||||||
|
|
||||||
|
mApplication.setWindowIcon (QIcon (":./opencs.png"));
|
||||||
|
|
||||||
CS::Editor editor;
|
CS::Editor editor;
|
||||||
|
|
||||||
return editor.run();
|
return editor.run();
|
||||||
|
|
|
@ -29,7 +29,8 @@ namespace CSMWorld
|
||||||
Display_String,
|
Display_String,
|
||||||
Display_Integer,
|
Display_Integer,
|
||||||
Display_Float,
|
Display_Float,
|
||||||
Display_Var
|
Display_Var,
|
||||||
|
Display_VarType
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string mTitle;
|
std::string mTitle;
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace CSMWorld
|
||||||
int mType;
|
int mType;
|
||||||
|
|
||||||
FixedRecordTypeColumn (int type)
|
FixedRecordTypeColumn (int type)
|
||||||
: Column<ESXRecordT> ("Type", ColumnBase::Display_Integer, 0), mType (type) {}
|
: Column<ESXRecordT> ("Record Type", ColumnBase::Display_Integer, 0), mType (type) {}
|
||||||
|
|
||||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
{
|
{
|
||||||
|
@ -92,10 +92,11 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \attention A var type column must be immediately followed by a suitable value column.
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
struct VarTypeColumn : public Column<ESXRecordT>
|
struct VarTypeColumn : public Column<ESXRecordT>
|
||||||
{
|
{
|
||||||
VarTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_Integer) {}
|
VarTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_VarType) {}
|
||||||
|
|
||||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,11 @@ void CSMWorld::Data::merge()
|
||||||
void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||||
{
|
{
|
||||||
ESM::ESMReader reader;
|
ESM::ESMReader reader;
|
||||||
/// \todo set encoder
|
|
||||||
|
/// \todo set encoding properly, once config implementation has been fixed.
|
||||||
|
ToUTF8::Utf8Encoder encoder (ToUTF8::calculateEncoding ("win1252"));
|
||||||
|
reader.setEncoder (&encoder);
|
||||||
|
|
||||||
reader.open (path.string());
|
reader.open (path.string());
|
||||||
|
|
||||||
// Note: We do not need to send update signals here, because at this point the model is not connected
|
// Note: We do not need to send update signals here, because at this point the model is not connected
|
||||||
|
|
|
@ -11,7 +11,7 @@ OpenDialog::OpenDialog(QWidget * parent) : QDialog(parent)
|
||||||
mFileSelector = new DataFilesList(mCfgMgr, this);
|
mFileSelector = new DataFilesList(mCfgMgr, this);
|
||||||
layout->addWidget(mFileSelector);
|
layout->addWidget(mFileSelector);
|
||||||
|
|
||||||
//FIXME - same as DataFilesPage::setupDataFiles
|
/// \todo move config to Editor class and add command line options.
|
||||||
// We use the Configuration Manager to retrieve the configuration values
|
// We use the Configuration Manager to retrieve the configuration values
|
||||||
boost::program_options::variables_map variables;
|
boost::program_options::variables_map variables;
|
||||||
boost::program_options::options_description desc;
|
boost::program_options::options_description desc;
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
#include "../../model/doc/documentmanager.hpp"
|
#include "../../model/doc/documentmanager.hpp"
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
|
|
||||||
|
#include "../world/util.hpp"
|
||||||
|
#include "../world/enumdelegate.hpp"
|
||||||
|
#include "../world/vartypedelegate.hpp"
|
||||||
|
|
||||||
#include "view.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
void CSVDoc::ViewManager::updateIndices()
|
void CSVDoc::ViewManager::updateIndices()
|
||||||
|
@ -29,11 +33,16 @@ void CSVDoc::ViewManager::updateIndices()
|
||||||
CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
||||||
: mDocumentManager (documentManager)
|
: mDocumentManager (documentManager)
|
||||||
{
|
{
|
||||||
|
mDelegateFactories = new CSVWorld::CommandDelegateFactoryCollection;
|
||||||
|
|
||||||
|
mDelegateFactories->add (CSMWorld::ColumnBase::Display_VarType,
|
||||||
|
new CSVWorld::VarTypeDelegateFactory (ESM::VT_None, ESM::VT_String, ESM::VT_Int, ESM::VT_Float));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::ViewManager::~ViewManager()
|
CSVDoc::ViewManager::~ViewManager()
|
||||||
{
|
{
|
||||||
|
delete mDelegateFactories;
|
||||||
|
|
||||||
for (std::vector<View *>::iterator iter (mViews.begin()); iter!=mViews.end(); ++iter)
|
for (std::vector<View *>::iterator iter (mViews.begin()); iter!=mViews.end(); ++iter)
|
||||||
delete *iter;
|
delete *iter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@ namespace CSMDoc
|
||||||
class DocumentManager;
|
class DocumentManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
class CommandDelegateFactoryCollection;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVDoc
|
namespace CSVDoc
|
||||||
{
|
{
|
||||||
class View;
|
class View;
|
||||||
|
@ -21,6 +26,7 @@ namespace CSVDoc
|
||||||
|
|
||||||
CSMDoc::DocumentManager& mDocumentManager;
|
CSMDoc::DocumentManager& mDocumentManager;
|
||||||
std::vector<View *> mViews;
|
std::vector<View *> mViews;
|
||||||
|
CSVWorld::CommandDelegateFactoryCollection *mDelegateFactories;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
ViewManager (const ViewManager&);
|
ViewManager (const ViewManager&);
|
||||||
|
|
101
apps/opencs/view/world/enumdelegate.cpp
Normal file
101
apps/opencs/view/world/enumdelegate.cpp
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
#include "enumdelegate.hpp"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QUndoStack>
|
||||||
|
|
||||||
|
#include "../../model/world/commands.hpp"
|
||||||
|
|
||||||
|
void CSVWorld::EnumDelegate::setModelDataImp (QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if (QComboBox *comboBox = dynamic_cast<QComboBox *> (editor))
|
||||||
|
{
|
||||||
|
QString value = comboBox->currentText();
|
||||||
|
|
||||||
|
for (std::vector<std::pair<int, QString> >::const_iterator iter (mValues.begin());
|
||||||
|
iter!=mValues.end(); ++iter)
|
||||||
|
if (iter->second==value)
|
||||||
|
{
|
||||||
|
addCommands (model, index, iter->first);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::EnumDelegate::addCommands (QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index, int type) const
|
||||||
|
{
|
||||||
|
getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSVWorld::EnumDelegate::EnumDelegate (const std::vector<std::pair<int, QString> >& values,
|
||||||
|
QUndoStack& undoStack, QObject *parent)
|
||||||
|
: CommandDelegate (undoStack, parent), mValues (values)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
QComboBox *comboBox = new QComboBox (parent);
|
||||||
|
|
||||||
|
for (std::vector<std::pair<int, QString> >::const_iterator iter (mValues.begin());
|
||||||
|
iter!=mValues.end(); ++iter)
|
||||||
|
comboBox->addItem (iter->second);
|
||||||
|
|
||||||
|
return comboBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::EnumDelegate::setEditorData (QWidget *editor, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if (QComboBox *comboBox = dynamic_cast<QComboBox *> (editor))
|
||||||
|
{
|
||||||
|
int value = index.data (Qt::EditRole).toInt();
|
||||||
|
|
||||||
|
std::size_t size = mValues.size();
|
||||||
|
|
||||||
|
for (std::size_t i=0; i<size; ++i)
|
||||||
|
if (mValues[i].first==value)
|
||||||
|
{
|
||||||
|
comboBox->setCurrentIndex (i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::EnumDelegate::paint (QPainter *painter, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
QStyleOptionViewItemV4 option2 (option);
|
||||||
|
|
||||||
|
int value = index.data().toInt();
|
||||||
|
|
||||||
|
for (std::vector<std::pair<int, QString> >::const_iterator iter (mValues.begin());
|
||||||
|
iter!=mValues.end(); ++iter)
|
||||||
|
if (iter->first==value)
|
||||||
|
{
|
||||||
|
option2.text = iter->second;
|
||||||
|
|
||||||
|
QApplication::style()->drawControl (QStyle::CE_ItemViewItem, &option2, painter);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegate *CSVWorld::EnumDelegateFactory::makeDelegate (QUndoStack& undoStack,
|
||||||
|
QObject *parent) const
|
||||||
|
{
|
||||||
|
return new EnumDelegate (mValues, undoStack, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::EnumDelegateFactory::add (int value, const QString& name)
|
||||||
|
{
|
||||||
|
mValues.push_back (std::make_pair (value, name));
|
||||||
|
}
|
57
apps/opencs/view/world/enumdelegate.hpp
Normal file
57
apps/opencs/view/world/enumdelegate.hpp
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#ifndef CSV_WORLD_ENUMDELEGATE_H
|
||||||
|
#define CSV_WORLD_ENUMDELEGATE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include <components/esm/defs.hpp>
|
||||||
|
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
/// \brief Integer value that represents an enum and is interacted with via a combobox
|
||||||
|
class EnumDelegate : public CommandDelegate
|
||||||
|
{
|
||||||
|
std::vector<std::pair<int, QString> > mValues;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual void setModelDataImp (QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
|
virtual void addCommands (QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index, int type) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
EnumDelegate (const std::vector<std::pair<int, QString> >& values,
|
||||||
|
QUndoStack& undoStack, QObject *parent);
|
||||||
|
|
||||||
|
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
|
virtual void setEditorData (QWidget *editor, const QModelIndex& index) const;
|
||||||
|
|
||||||
|
virtual void paint (QPainter *painter, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class EnumDelegateFactory : public CommandDelegateFactory
|
||||||
|
{
|
||||||
|
std::vector<std::pair<int, QString> > mValues;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||||
|
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||||
|
|
||||||
|
void add (int value, const QString& name);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -102,7 +102,12 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, Q
|
||||||
|
|
||||||
if (flags & CSMWorld::ColumnBase::Flag_Table)
|
if (flags & CSMWorld::ColumnBase::Flag_Table)
|
||||||
{
|
{
|
||||||
CommandDelegate *delegate = new CommandDelegate (undoStack, this);
|
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
|
||||||
|
mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
||||||
|
|
||||||
|
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate (display,
|
||||||
|
undoStack, this);
|
||||||
|
|
||||||
mDelegates.push_back (delegate);
|
mDelegates.push_back (delegate);
|
||||||
setItemDelegateForColumn (i, delegate);
|
setItemDelegateForColumn (i, delegate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
#include "../../model/world/commands.hpp"
|
#include "../../model/world/commands.hpp"
|
||||||
|
@ -35,6 +37,70 @@ QVariant CSVWorld::NastyTableModelHack::getData() const
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegateFactory::~CommandDelegateFactory() {}
|
||||||
|
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegateFactoryCollection *CSVWorld::CommandDelegateFactoryCollection::sThis = 0;
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegateFactoryCollection::CommandDelegateFactoryCollection()
|
||||||
|
{
|
||||||
|
if (sThis)
|
||||||
|
throw std::logic_error ("multiple instances of CSVWorld::CommandDelegateFactoryCollection");
|
||||||
|
|
||||||
|
sThis = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegateFactoryCollection::~CommandDelegateFactoryCollection()
|
||||||
|
{
|
||||||
|
sThis = 0;
|
||||||
|
|
||||||
|
for (std::map<CSMWorld::ColumnBase::Display, CommandDelegateFactory *>::iterator iter (
|
||||||
|
mFactories.begin());
|
||||||
|
iter!=mFactories.end(); ++iter)
|
||||||
|
delete iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::CommandDelegateFactoryCollection::add (CSMWorld::ColumnBase::Display display,
|
||||||
|
CommandDelegateFactory *factory)
|
||||||
|
{
|
||||||
|
mFactories.insert (std::make_pair (display, factory));
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegate *CSVWorld::CommandDelegateFactoryCollection::makeDelegate (
|
||||||
|
CSMWorld::ColumnBase::Display display, QUndoStack& undoStack, QObject *parent) const
|
||||||
|
{
|
||||||
|
std::map<CSMWorld::ColumnBase::Display, CommandDelegateFactory *>::const_iterator iter =
|
||||||
|
mFactories.find (display);
|
||||||
|
|
||||||
|
if (iter!=mFactories.end())
|
||||||
|
return iter->second->makeDelegate (undoStack, parent);
|
||||||
|
|
||||||
|
return new CommandDelegate (undoStack, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CSVWorld::CommandDelegateFactoryCollection& CSVWorld::CommandDelegateFactoryCollection::get()
|
||||||
|
{
|
||||||
|
if (!sThis)
|
||||||
|
throw std::logic_error ("no instance of CSVWorld::CommandDelegateFactoryCollection");
|
||||||
|
|
||||||
|
return *sThis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QUndoStack& CSVWorld::CommandDelegate::getUndoStack() const
|
||||||
|
{
|
||||||
|
return mUndoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
NastyTableModelHack hack (*model);
|
||||||
|
QStyledItemDelegate::setModelData (editor, &hack, index);
|
||||||
|
mUndoStack.push (new CSMWorld::ModifyCommand (*model, index, hack.getData()));
|
||||||
|
}
|
||||||
|
|
||||||
CSVWorld::CommandDelegate::CommandDelegate (QUndoStack& undoStack, QObject *parent)
|
CSVWorld::CommandDelegate::CommandDelegate (QUndoStack& undoStack, QObject *parent)
|
||||||
: QStyledItemDelegate (parent), mUndoStack (undoStack), mEditLock (false)
|
: QStyledItemDelegate (parent), mUndoStack (undoStack), mEditLock (false)
|
||||||
{}
|
{}
|
||||||
|
@ -44,10 +110,9 @@ void CSVWorld::CommandDelegate::setModelData (QWidget *editor, QAbstractItemMode
|
||||||
{
|
{
|
||||||
if (!mEditLock)
|
if (!mEditLock)
|
||||||
{
|
{
|
||||||
NastyTableModelHack hack (*model);
|
setModelDataImp (editor, model, index);
|
||||||
QStyledItemDelegate::setModelData (editor, &hack, index);
|
|
||||||
mUndoStack.push (new CSMWorld::ModifyCommand (*model, index, hack.getData()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///< \todo provide some kind of feedback to the user, indicating that editing is currently not possible.
|
///< \todo provide some kind of feedback to the user, indicating that editing is currently not possible.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,3 +120,8 @@ void CSVWorld::CommandDelegate::setEditLock (bool locked)
|
||||||
{
|
{
|
||||||
mEditLock = locked;
|
mEditLock = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSVWorld::CommandDelegate::isEditLocked() const
|
||||||
|
{
|
||||||
|
return mEditLock;
|
||||||
|
}
|
|
@ -1,9 +1,13 @@
|
||||||
#ifndef CSV_WORLD_UTIL_H
|
#ifndef CSV_WORLD_UTIL_H
|
||||||
#define CSV_WORLD_UTIL_H
|
#define CSV_WORLD_UTIL_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
#include "../../model/world/columnbase.hpp"
|
||||||
|
|
||||||
class QUndoStack;
|
class QUndoStack;
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
|
@ -31,19 +35,73 @@ namespace CSVWorld
|
||||||
QVariant getData() const;
|
QVariant getData() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CommandDelegate;
|
||||||
|
|
||||||
|
class CommandDelegateFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~CommandDelegateFactory();
|
||||||
|
|
||||||
|
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const = 0;
|
||||||
|
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||||
|
};
|
||||||
|
|
||||||
|
class CommandDelegateFactoryCollection
|
||||||
|
{
|
||||||
|
static CommandDelegateFactoryCollection *sThis;
|
||||||
|
std::map<CSMWorld::ColumnBase::Display, CommandDelegateFactory *> mFactories;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// not implemented
|
||||||
|
CommandDelegateFactoryCollection (const CommandDelegateFactoryCollection&);
|
||||||
|
CommandDelegateFactoryCollection& operator= (const CommandDelegateFactoryCollection&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
CommandDelegateFactoryCollection();
|
||||||
|
|
||||||
|
~CommandDelegateFactoryCollection();
|
||||||
|
|
||||||
|
void add (CSMWorld::ColumnBase::Display display, CommandDelegateFactory *factory);
|
||||||
|
///< The ownership of \æ factory is transferred to *this.
|
||||||
|
///
|
||||||
|
/// This function must not be called more than once per value of \æ display.
|
||||||
|
|
||||||
|
CommandDelegate *makeDelegate (CSMWorld::ColumnBase::Display display, QUndoStack& undoStack,
|
||||||
|
QObject *parent) const;
|
||||||
|
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||||
|
///
|
||||||
|
/// If no factory is registered for \a display, a CommandDelegate will be returned.
|
||||||
|
|
||||||
|
static const CommandDelegateFactoryCollection& get();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
///< \brief Use commands instead of manipulating the model directly
|
///< \brief Use commands instead of manipulating the model directly
|
||||||
class CommandDelegate : public QStyledItemDelegate
|
class CommandDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
QUndoStack& mUndoStack;
|
QUndoStack& mUndoStack;
|
||||||
bool mEditLock;
|
bool mEditLock;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
QUndoStack& getUndoStack() const;
|
||||||
|
|
||||||
|
virtual void setModelDataImp (QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CommandDelegate (QUndoStack& undoStack, QObject *parent);
|
CommandDelegate (QUndoStack& undoStack, QObject *parent);
|
||||||
|
|
||||||
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const;
|
virtual void setModelData (QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
void setEditLock (bool locked);
|
void setEditLock (bool locked);
|
||||||
|
|
||||||
|
bool isEditLocked() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
103
apps/opencs/view/world/vartypedelegate.cpp
Normal file
103
apps/opencs/view/world/vartypedelegate.cpp
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
|
||||||
|
#include "vartypedelegate.hpp"
|
||||||
|
|
||||||
|
#include <QUndoStack>
|
||||||
|
|
||||||
|
#include "../../model/world/commands.hpp"
|
||||||
|
|
||||||
|
void CSVWorld::VarTypeDelegate::addCommands (QAbstractItemModel *model, const QModelIndex& index, int type)
|
||||||
|
const
|
||||||
|
{
|
||||||
|
QModelIndex next = model->index (index.row(), index.column()+1);
|
||||||
|
|
||||||
|
QVariant old = model->data (next);
|
||||||
|
|
||||||
|
QVariant value;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case ESM::VT_Short:
|
||||||
|
case ESM::VT_Int:
|
||||||
|
case ESM::VT_Long:
|
||||||
|
|
||||||
|
value = old.toInt();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ESM::VT_Float:
|
||||||
|
|
||||||
|
value = old.toFloat();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ESM::VT_String:
|
||||||
|
|
||||||
|
value = old.toString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: break; // ignore the rest
|
||||||
|
}
|
||||||
|
|
||||||
|
getUndoStack().beginMacro (
|
||||||
|
"Modify " + model->headerData (index.column(), Qt::Horizontal, Qt::DisplayRole).toString());
|
||||||
|
|
||||||
|
getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, type));
|
||||||
|
getUndoStack().push (new CSMWorld::ModifyCommand (*model, next, value));
|
||||||
|
|
||||||
|
getUndoStack().endMacro();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWorld::VarTypeDelegate::VarTypeDelegate (const std::vector<std::pair<int, QString> >& values,
|
||||||
|
QUndoStack& undoStack, QObject *parent)
|
||||||
|
: EnumDelegate (values, undoStack, parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
CSVWorld::VarTypeDelegateFactory::VarTypeDelegateFactory (ESM::VarType type0,
|
||||||
|
ESM::VarType type1, ESM::VarType type2, ESM::VarType type3)
|
||||||
|
{
|
||||||
|
if (type0!=ESM::VT_Unknown)
|
||||||
|
add (type0);
|
||||||
|
|
||||||
|
if (type1!=ESM::VT_Unknown)
|
||||||
|
add (type1);
|
||||||
|
|
||||||
|
if (type2!=ESM::VT_Unknown)
|
||||||
|
add (type2);
|
||||||
|
|
||||||
|
if (type3!=ESM::VT_Unknown)
|
||||||
|
add (type3);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWorld::CommandDelegate *CSVWorld::VarTypeDelegateFactory::makeDelegate (QUndoStack& undoStack,
|
||||||
|
QObject *parent) const
|
||||||
|
{
|
||||||
|
return new VarTypeDelegate (mValues, undoStack, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::VarTypeDelegateFactory::add (ESM::VarType type)
|
||||||
|
{
|
||||||
|
struct Name
|
||||||
|
{
|
||||||
|
ESM::VarType mType;
|
||||||
|
const char *mName;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Name sNames[] =
|
||||||
|
{
|
||||||
|
{ ESM::VT_None, "empty" },
|
||||||
|
{ ESM::VT_Short, "short" },
|
||||||
|
{ ESM::VT_Int, "long" },
|
||||||
|
{ ESM::VT_Long, "long" },
|
||||||
|
{ ESM::VT_Float, "float" },
|
||||||
|
{ ESM::VT_String, "string" },
|
||||||
|
{ ESM::VT_Unknown, 0 } // end marker
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i=0; sNames[i].mName; ++i)
|
||||||
|
if (sNames[i].mType==type)
|
||||||
|
{
|
||||||
|
mValues.push_back (std::make_pair (type, sNames[i].mName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw std::logic_error ("Unsupported variable type");
|
||||||
|
}
|
38
apps/opencs/view/world/vartypedelegate.hpp
Normal file
38
apps/opencs/view/world/vartypedelegate.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef CSV_WORLD_VARTYPEDELEGATE_H
|
||||||
|
#define CSV_WORLD_VARTYPEDELEGATE_H
|
||||||
|
|
||||||
|
#include "enumdelegate.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
class VarTypeDelegate : public EnumDelegate
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual void addCommands (QAbstractItemModel *model,
|
||||||
|
const QModelIndex& index, int type) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VarTypeDelegate (const std::vector<std::pair<int, QString> >& values,
|
||||||
|
QUndoStack& undoStack, QObject *parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
class VarTypeDelegateFactory : public CommandDelegateFactory
|
||||||
|
{
|
||||||
|
std::vector<std::pair<int, QString> > mValues;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VarTypeDelegateFactory (ESM::VarType type0 = ESM::VT_Unknown,
|
||||||
|
ESM::VarType type1 = ESM::VT_Unknown, ESM::VarType type2 = ESM::VT_Unknown,
|
||||||
|
ESM::VarType type3 = ESM::VT_Unknown);
|
||||||
|
|
||||||
|
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||||
|
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||||
|
|
||||||
|
void add (ESM::VarType type);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwworld/actionalchemy.hpp"
|
#include "../mwworld/actionalchemy.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
@ -61,6 +62,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(
|
boost::shared_ptr<MWWorld::Action> action(
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
@ -64,6 +65,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -62,6 +63,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/failedaction.hpp"
|
#include "../mwworld/failedaction.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
@ -85,6 +86,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
const std::string lockedSound = "LockedChest";
|
const std::string lockedSound = "LockedChest";
|
||||||
const std::string trapActivationSound = "Disarm Trap Fail";
|
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/actioneat.hpp"
|
#include "../mwworld/actioneat.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
|
@ -72,6 +73,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -88,6 +88,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -62,6 +63,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
#include "../mwworld/manualref.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -65,6 +66,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -62,6 +63,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(
|
boost::shared_ptr<MWWorld::Action> action(
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -61,6 +62,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -60,6 +61,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -62,6 +63,9 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
action->setSound(getUpSoundId(ptr));
|
action->setSound(getUpSoundId(ptr));
|
||||||
|
|
|
@ -48,7 +48,6 @@ BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
||||||
okButton->setEnabled(false);
|
|
||||||
|
|
||||||
updateBirths();
|
updateBirths();
|
||||||
updateSpells();
|
updateSpells();
|
||||||
|
@ -85,7 +84,6 @@ void BirthDialog::setBirthId(const std::string &birthId)
|
||||||
mBirthList->setIndexSelected(i);
|
mBirthList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +112,6 @@ void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
|
|
||||||
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
||||||
if (boost::iequals(mCurrentBirthId, *birthId))
|
if (boost::iequals(mCurrentBirthId, *birthId))
|
||||||
|
|
|
@ -14,8 +14,10 @@
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager) :
|
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager)
|
||||||
WindowBase("openmw_book.layout", parWindowManager)
|
: WindowBase("openmw_book.layout", parWindowManager)
|
||||||
|
, mTakeButtonShow(true)
|
||||||
|
, mTakeButtonAllowed(true)
|
||||||
{
|
{
|
||||||
getWidget(mCloseButton, "CloseButton");
|
getWidget(mCloseButton, "CloseButton");
|
||||||
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
||||||
|
@ -85,7 +87,14 @@ void BookWindow::open (MWWorld::Ptr book)
|
||||||
|
|
||||||
void BookWindow::setTakeButtonShow(bool show)
|
void BookWindow::setTakeButtonShow(bool show)
|
||||||
{
|
{
|
||||||
mTakeButton->setVisible(show);
|
mTakeButtonShow = show;
|
||||||
|
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookWindow::setInventoryAllowed(bool allowed)
|
||||||
|
{
|
||||||
|
mTakeButtonAllowed = allowed;
|
||||||
|
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace MWGui
|
||||||
void open(MWWorld::Ptr book);
|
void open(MWWorld::Ptr book);
|
||||||
void setTakeButtonShow(bool show);
|
void setTakeButtonShow(bool show);
|
||||||
|
|
||||||
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onNextPageButtonClicked (MyGUI::Widget* sender);
|
void onNextPageButtonClicked (MyGUI::Widget* sender);
|
||||||
void onPrevPageButtonClicked (MyGUI::Widget* sender);
|
void onPrevPageButtonClicked (MyGUI::Widget* sender);
|
||||||
|
@ -40,6 +42,9 @@ namespace MWGui
|
||||||
std::vector<MyGUI::Widget*> mPages;
|
std::vector<MyGUI::Widget*> mPages;
|
||||||
|
|
||||||
MWWorld::Ptr mBook;
|
MWWorld::Ptr mBook;
|
||||||
|
|
||||||
|
bool mTakeButtonShow;
|
||||||
|
bool mTakeButtonAllowed;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
||||||
okButton->setEnabled(false);
|
|
||||||
|
|
||||||
updateClasses();
|
updateClasses();
|
||||||
updateStats();
|
updateStats();
|
||||||
|
@ -140,7 +139,6 @@ void PickClassDialog::setClassId(const std::string &classId)
|
||||||
mClassList->setIndexSelected(i);
|
mClassList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +167,6 @@ void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
|
|
||||||
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
||||||
if (boost::iequals(mCurrentClassId, *classId))
|
if (boost::iequals(mCurrentClassId, *classId))
|
||||||
|
|
|
@ -81,7 +81,6 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
|
||||||
okButton->setEnabled(false);
|
|
||||||
|
|
||||||
updateRaces();
|
updateRaces();
|
||||||
updateSkills();
|
updateSkills();
|
||||||
|
@ -135,7 +134,6 @@ void RaceDialog::setRaceId(const std::string &raceId)
|
||||||
mRaceList->setIndexSelected(i);
|
mRaceList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +256,6 @@ void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index)
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::ButtonPtr okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setEnabled(true);
|
|
||||||
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
|
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
|
||||||
if (boost::iequals(mCurrentRaceId, *raceId))
|
if (boost::iequals(mCurrentRaceId, *raceId))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
ScrollWindow::ScrollWindow (MWBase::WindowManager& parWindowManager) :
|
ScrollWindow::ScrollWindow (MWBase::WindowManager& parWindowManager)
|
||||||
WindowBase("openmw_scroll.layout", parWindowManager)
|
: WindowBase("openmw_scroll.layout", parWindowManager)
|
||||||
|
, mTakeButtonShow(true)
|
||||||
|
, mTakeButtonAllowed(true)
|
||||||
{
|
{
|
||||||
getWidget(mTextView, "TextView");
|
getWidget(mTextView, "TextView");
|
||||||
|
|
||||||
|
@ -50,7 +52,14 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
|
||||||
|
|
||||||
void ScrollWindow::setTakeButtonShow(bool show)
|
void ScrollWindow::setTakeButtonShow(bool show)
|
||||||
{
|
{
|
||||||
mTakeButton->setVisible(show);
|
mTakeButtonShow = show;
|
||||||
|
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollWindow::setInventoryAllowed(bool allowed)
|
||||||
|
{
|
||||||
|
mTakeButtonAllowed = allowed;
|
||||||
|
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace MWGui
|
||||||
|
|
||||||
void open (MWWorld::Ptr scroll);
|
void open (MWWorld::Ptr scroll);
|
||||||
void setTakeButtonShow(bool show);
|
void setTakeButtonShow(bool show);
|
||||||
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
||||||
|
@ -26,6 +27,10 @@ namespace MWGui
|
||||||
MyGUI::ScrollView* mTextView;
|
MyGUI::ScrollView* mTextView;
|
||||||
|
|
||||||
MWWorld::Ptr mScroll;
|
MWWorld::Ptr mScroll;
|
||||||
|
|
||||||
|
bool mTakeButtonShow;
|
||||||
|
bool mTakeButtonAllowed;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,8 @@ namespace MWGui
|
||||||
if (mWindowManager.getInventoryWindow()->getPlayerGold()<price)
|
if (mWindowManager.getInventoryWindow()->getPlayerGold()<price)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mWindowManager.getTradeWindow ()->addOrRemoveGold (-price);
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(1);
|
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(1);
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
||||||
|
|
|
@ -109,7 +109,6 @@ WindowManager::WindowManager(
|
||||||
, mHudEnabled(true)
|
, mHudEnabled(true)
|
||||||
, mTranslationDataStorage (translationDataStorage)
|
, mTranslationDataStorage (translationDataStorage)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set up the GUI system
|
// Set up the GUI system
|
||||||
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath);
|
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath);
|
||||||
mGui = mGuiManager->getGui();
|
mGui = mGuiManager->getGui();
|
||||||
|
@ -196,6 +195,9 @@ WindowManager::WindowManager(
|
||||||
unsetSelectedSpell();
|
unsetSelectedSpell();
|
||||||
unsetSelectedWeapon();
|
unsetSelectedWeapon();
|
||||||
|
|
||||||
|
if (newGame)
|
||||||
|
disallowAll ();
|
||||||
|
|
||||||
// Set up visibility
|
// Set up visibility
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
@ -943,12 +945,23 @@ bool WindowManager::isAllowed (GuiWindow wnd) const
|
||||||
void WindowManager::allow (GuiWindow wnd)
|
void WindowManager::allow (GuiWindow wnd)
|
||||||
{
|
{
|
||||||
mAllowed = (GuiWindow)(mAllowed | wnd);
|
mAllowed = (GuiWindow)(mAllowed | wnd);
|
||||||
|
|
||||||
|
if (wnd & GW_Inventory)
|
||||||
|
{
|
||||||
|
mBookWindow->setInventoryAllowed (true);
|
||||||
|
mScrollWindow->setInventoryAllowed (true);
|
||||||
|
}
|
||||||
|
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::disallowAll()
|
void WindowManager::disallowAll()
|
||||||
{
|
{
|
||||||
mAllowed = GW_None;
|
mAllowed = GW_None;
|
||||||
|
|
||||||
|
mBookWindow->setInventoryAllowed (false);
|
||||||
|
mScrollWindow->setInventoryAllowed (false);
|
||||||
|
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ namespace MWInput
|
||||||
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
||||||
, mPreviewPOVDelay(0.f)
|
, mPreviewPOVDelay(0.f)
|
||||||
, mTimeIdle(0.f)
|
, mTimeIdle(0.f)
|
||||||
, mEnterPressed(false)
|
|
||||||
{
|
{
|
||||||
Ogre::RenderWindow* window = ogre.getWindow ();
|
Ogre::RenderWindow* window = ogre.getWindow ();
|
||||||
size_t windowHnd;
|
size_t windowHnd;
|
||||||
|
@ -240,10 +239,6 @@ namespace MWInput
|
||||||
|
|
||||||
void InputManager::update(float dt, bool loading)
|
void InputManager::update(float dt, bool loading)
|
||||||
{
|
{
|
||||||
// Pressing enter when a messagebox is prompting for "ok" will activate the ok button
|
|
||||||
if(mEnterPressed && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox)
|
|
||||||
MWBase::Environment::get().getWindowManager()->enterPressed();
|
|
||||||
|
|
||||||
// Tell OIS to handle all input events
|
// Tell OIS to handle all input events
|
||||||
mKeyboard->capture();
|
mKeyboard->capture();
|
||||||
mMouse->capture();
|
mMouse->capture();
|
||||||
|
@ -436,8 +431,13 @@ namespace MWInput
|
||||||
|
|
||||||
bool InputManager::keyPressed( const OIS::KeyEvent &arg )
|
bool InputManager::keyPressed( const OIS::KeyEvent &arg )
|
||||||
{
|
{
|
||||||
if(arg.key == OIS::KC_RETURN && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console)
|
if(arg.key == OIS::KC_RETURN
|
||||||
mEnterPressed = true;
|
&& MWBase::Environment::get().getWindowManager()->isGuiMode()
|
||||||
|
&& MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox )
|
||||||
|
{
|
||||||
|
// Pressing enter when a messagebox is prompting for "ok" will activate the ok button
|
||||||
|
MWBase::Environment::get().getWindowManager()->enterPressed();
|
||||||
|
}
|
||||||
|
|
||||||
mInputCtrl->keyPressed (arg);
|
mInputCtrl->keyPressed (arg);
|
||||||
unsigned int text = arg.text;
|
unsigned int text = arg.text;
|
||||||
|
@ -455,9 +455,6 @@ namespace MWInput
|
||||||
|
|
||||||
bool InputManager::keyReleased( const OIS::KeyEvent &arg )
|
bool InputManager::keyReleased( const OIS::KeyEvent &arg )
|
||||||
{
|
{
|
||||||
if(arg.key == OIS::KC_RETURN)
|
|
||||||
mEnterPressed = false;
|
|
||||||
|
|
||||||
mInputCtrl->keyReleased (arg);
|
mInputCtrl->keyReleased (arg);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
|
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
|
||||||
|
@ -643,6 +640,8 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
if (!mWindows.isGuiMode ())
|
if (!mWindows.isGuiMode ())
|
||||||
mWindows.pushGuiMode (MWGui::GM_QuickKeysMenu);
|
mWindows.pushGuiMode (MWGui::GM_QuickKeysMenu);
|
||||||
|
else if (mWindows.getMode () == MWGui::GM_QuickKeysMenu)
|
||||||
|
mWindows.removeGuiMode (MWGui::GM_QuickKeysMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::activate()
|
void InputManager::activate()
|
||||||
|
|
|
@ -151,8 +151,6 @@ namespace MWInput
|
||||||
|
|
||||||
std::map<std::string, bool> mControlSwitch;
|
std::map<std::string, bool> mControlSwitch;
|
||||||
|
|
||||||
bool mEnterPressed;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjustMouseRegion(int width, int height);
|
void adjustMouseRegion(int width, int height);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/actionequip.hpp"
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
@ -47,6 +48,10 @@ namespace MWScript
|
||||||
if (count<0)
|
if (count<0)
|
||||||
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
||||||
|
|
||||||
|
// no-op
|
||||||
|
if (count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item);
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item);
|
||||||
|
|
||||||
ref.getPtr().getRefData().setCount (count);
|
ref.getPtr().getRefData().setCount (count);
|
||||||
|
@ -60,6 +65,26 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr());
|
MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr());
|
||||||
|
|
||||||
|
// Spawn a messagebox (only for items added to player's inventory)
|
||||||
|
if (ptr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer())
|
||||||
|
{
|
||||||
|
// The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory
|
||||||
|
std::string msgBox;
|
||||||
|
std::string itemName = MWWorld::Class::get(ref.getPtr()).getName(ref.getPtr());
|
||||||
|
if (count == 1)
|
||||||
|
{
|
||||||
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage60}");
|
||||||
|
msgBox = boost::str(boost::format(msgBox) % itemName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage61}");
|
||||||
|
msgBox = boost::str(boost::format(msgBox) % count % itemName);
|
||||||
|
}
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, std::vector<std::string>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,9 +130,15 @@ namespace MWScript
|
||||||
if (count<0)
|
if (count<0)
|
||||||
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
||||||
|
|
||||||
|
// no-op
|
||||||
|
if (count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
||||||
|
|
||||||
std::string itemName = "";
|
std::string itemName = "";
|
||||||
|
|
||||||
|
// originalCount holds the total number of items to remove, count holds the remaining number of items to remove
|
||||||
Interpreter::Type_Integer originalCount = count;
|
Interpreter::Type_Integer originalCount = count;
|
||||||
|
|
||||||
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
|
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
|
||||||
|
@ -130,28 +161,26 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The two GMST entries below expand to strings informing the player of what, and how many of it has been removed from their inventory */
|
// Spawn a messagebox (only for items added to player's inventory)
|
||||||
|
if (ptr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer())
|
||||||
|
{
|
||||||
|
// The two GMST entries below expand to strings informing the player of what, and how many of it has been removed from their inventory
|
||||||
std::string msgBox;
|
std::string msgBox;
|
||||||
if(originalCount - count > 1)
|
int numRemoved = (originalCount - count);
|
||||||
|
if(numRemoved > 1)
|
||||||
{
|
{
|
||||||
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage63}");
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage63}");
|
||||||
std::stringstream temp;
|
msgBox = boost::str (boost::format(msgBox) % numRemoved % itemName);
|
||||||
temp << boost::format(msgBox) % (originalCount - count) % itemName;
|
|
||||||
msgBox = temp.str();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage62}");
|
msgBox = MyGUI::LanguageManager::getInstance().replaceTags("#{sNotifyMessage62}");
|
||||||
std::stringstream temp;
|
msgBox = boost::str (boost::format(msgBox) % itemName);
|
||||||
temp << boost::format(msgBox) % itemName;
|
|
||||||
msgBox = temp.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(originalCount - count > 0)
|
if (numRemoved > 0)
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, std::vector<std::string>());
|
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, std::vector<std::string>());
|
||||||
|
}
|
||||||
// To be fully compatible with original Morrowind, we would need to check if
|
|
||||||
// count is >= 0 here and throw an exception. But let's be tollerant instead.
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ MWWorld::Action::~Action() {}
|
||||||
|
|
||||||
void MWWorld::Action::execute (const Ptr& actor)
|
void MWWorld::Action::execute (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if (!mSoundId.empty() & executeImp (actor))
|
if (!mSoundId.empty())
|
||||||
{
|
{
|
||||||
if (mKeepSound && actor.getRefData().getHandle()=="player")
|
if (mKeepSound && actor.getRefData().getHandle()=="player")
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,8 @@ void MWWorld::Action::execute (const Ptr& actor)
|
||||||
mKeepSound ? MWBase::SoundManager::Play_NoTrack : MWBase::SoundManager::Play_Normal);
|
mKeepSound ? MWBase::SoundManager::Play_NoTrack : MWBase::SoundManager::Play_Normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
executeImp (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::Action::setSound (const std::string& id)
|
void MWWorld::Action::setSound (const std::string& id)
|
||||||
|
|
|
@ -18,8 +18,7 @@ namespace MWWorld
|
||||||
Action (const Action& action);
|
Action (const Action& action);
|
||||||
Action& operator= (const Action& action);
|
Action& operator= (const Action& action);
|
||||||
|
|
||||||
/// @return true if the sound should be played, false if not (e.g. if the action is not allowed)
|
virtual void executeImp (const Ptr& actor) = 0;
|
||||||
virtual bool executeImp (const Ptr& actor) = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
bool ActionAlchemy::executeImp (const Ptr& actor)
|
void ActionAlchemy::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Alchemy);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Alchemy);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionAlchemy : public Action
|
class ActionAlchemy : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,9 @@ namespace MWWorld
|
||||||
: Action (false, target), mId (id)
|
: Action (false, target), mId (id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool ActionApply::executeImp (const Ptr& actor)
|
void ActionApply::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor);
|
MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +20,9 @@ namespace MWWorld
|
||||||
: Action (false, target), mId (id), mSkillIndex (skillIndex), mUsageType (usageType)
|
: Action (false, target), mId (id), mSkillIndex (skillIndex), mUsageType (usageType)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool ActionApplyWithSkill::executeImp (const Ptr& actor)
|
void ActionApplyWithSkill::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if (MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor) && mUsageType!=-1)
|
if (MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor) && mUsageType!=-1)
|
||||||
MWWorld::Class::get (getTarget()).skillUsageSucceeded (actor, mSkillIndex, mUsageType);
|
MWWorld::Class::get (getTarget()).skillUsageSucceeded (actor, mSkillIndex, mUsageType);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
std::string mId;
|
std::string mId;
|
||||||
|
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace MWWorld
|
||||||
int mSkillIndex;
|
int mSkillIndex;
|
||||||
int mUsageType;
|
int mUsageType;
|
||||||
|
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
bool ActionEat::executeImp (const Ptr& actor)
|
void ActionEat::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
// remove used item
|
// remove used item
|
||||||
getTarget().getRefData().setCount (getTarget().getRefData().getCount()-1);
|
getTarget().getRefData().setCount (getTarget().getRefData().getCount()-1);
|
||||||
|
@ -42,8 +42,6 @@ namespace MWWorld
|
||||||
// increase skill
|
// increase skill
|
||||||
Class::get (actor).skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
|
Class::get (actor).skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}
|
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionEat : public Action
|
class ActionEat : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionEquip::executeImp (const Ptr& actor)
|
void ActionEquip::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
|
||||||
|
|
||||||
|
@ -113,7 +113,5 @@ namespace MWWorld
|
||||||
/* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */
|
/* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */
|
||||||
if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "")
|
if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "")
|
||||||
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 1);
|
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 1);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionEquip : public Action
|
class ActionEquip : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @param item to equip
|
/// @param item to equip
|
||||||
|
|
|
@ -14,13 +14,12 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionOpen::executeImp (const MWWorld::Ptr& actor)
|
void ActionOpen::executeImp (const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container);
|
||||||
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(getTarget());
|
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(getTarget());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionOpen : public Action
|
class ActionOpen : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const MWWorld::Ptr& actor);
|
virtual void executeImp (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ActionOpen (const Ptr& container);
|
ActionOpen (const Ptr& container);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionRead::executeImp (const MWWorld::Ptr& actor)
|
void ActionRead::executeImp (const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
|
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
|
||||||
|
|
||||||
|
@ -53,6 +53,5 @@ namespace MWWorld
|
||||||
npcStats.flagAsUsed (ref->mBase->mId);
|
npcStats.flagAsUsed (ref->mBase->mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionRead : public Action
|
class ActionRead : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const MWWorld::Ptr& actor);
|
virtual void executeImp (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @param book or scroll to read
|
/// @param book or scroll to read
|
||||||
|
|
|
@ -12,18 +12,13 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {}
|
ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {}
|
||||||
|
|
||||||
bool ActionTake::executeImp (const Ptr& actor)
|
void ActionTake::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// insert into player's inventory
|
// insert into player's inventory
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
|
||||||
|
|
||||||
MWWorld::Class::get (player).getContainerStore (player).add (getTarget());
|
MWWorld::Class::get (player).getContainerStore (player).add (getTarget());
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
|
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionTake : public Action
|
class ActionTake : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,13 @@
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
#include "../mwbase/inputmanager.hpp"
|
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
ActionTalk::ActionTalk (const Ptr& actor) : Action (false, actor) {}
|
ActionTalk::ActionTalk (const Ptr& actor) : Action (false, actor) {}
|
||||||
|
|
||||||
bool ActionTalk::executeImp (const Ptr& actor)
|
void ActionTalk::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getDialogueManager()->startDialogue (getTarget());
|
MWBase::Environment::get().getDialogueManager()->startDialogue (getTarget());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class ActionTalk : public Action
|
class ActionTalk : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,11 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionTeleport::executeImp (const Ptr& actor)
|
void ActionTeleport::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if (mCellName.empty())
|
if (mCellName.empty())
|
||||||
MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition);
|
MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition);
|
||||||
else
|
else
|
||||||
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, mPosition);
|
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, mPosition);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MWWorld
|
||||||
std::string mCellName;
|
std::string mCellName;
|
||||||
ESM::Position mPosition;
|
ESM::Position mPosition;
|
||||||
|
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,11 @@ namespace MWWorld
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
bool FailedAction::executeImp (const Ptr& actor)
|
void FailedAction::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if ( actor.getRefData().getHandle()=="player" && !(message.empty()))
|
if ( actor.getRefData().getHandle()=="player" && !(message.empty()))
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
virtual bool executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FailedAction (const std::string& message = std::string());
|
FailedAction (const std::string& message = std::string());
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWWorld
|
||||||
/// \brief Action: do nothing
|
/// \brief Action: do nothing
|
||||||
class NullAction : public Action
|
class NullAction : public Action
|
||||||
{
|
{
|
||||||
virtual bool executeImp (const Ptr& actor) {return false;}
|
virtual void executeImp (const Ptr& actor) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
files/opencs/opencs.png
Normal file
BIN
files/opencs/opencs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
5
files/opencs/resources.qrc
Normal file
5
files/opencs/resources.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>opencs.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Loading…
Reference in a new issue