mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-03 11:45:32 +00:00
Merge remote-tracking branch 'remotes/upstream/master' into pathgrid-edit
This commit is contained in:
commit
b46086912c
4 changed files with 25 additions and 9 deletions
|
@ -2382,7 +2382,8 @@ CSMWorld::UniversalId CSMDoc::Document::newSearch()
|
|||
|
||||
void CSMDoc::Document::runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search)
|
||||
{
|
||||
return mTools.runSearch (searchId, search);
|
||||
mTools.runSearch (searchId, search);
|
||||
emit stateChanged (getState(), this);
|
||||
}
|
||||
|
||||
void CSMDoc::Document::abortOperation (int type)
|
||||
|
|
|
@ -1,28 +1,37 @@
|
|||
#include "commands.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractProxyModel>
|
||||
|
||||
#include "idtable.hpp"
|
||||
#include "idtree.hpp"
|
||||
#include <components/misc/stringops.hpp>
|
||||
#include "nestedtablewrapper.hpp"
|
||||
|
||||
CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelIndex& index,
|
||||
const QVariant& new_, QUndoCommand* parent)
|
||||
: QUndoCommand (parent), mModel (model), mIndex (index), mNew (new_)
|
||||
: QUndoCommand (parent), mModel (&model), mIndex (index), mNew (new_)
|
||||
{
|
||||
setText ("Modify " + mModel.headerData (mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString());
|
||||
if (QAbstractProxyModel *proxy = dynamic_cast<QAbstractProxyModel *> (&model))
|
||||
{
|
||||
// Replace proxy with actual model
|
||||
mIndex = proxy->mapToSource (index);
|
||||
mModel = proxy->sourceModel();
|
||||
}
|
||||
|
||||
setText ("Modify " + mModel->headerData (mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString());
|
||||
}
|
||||
|
||||
void CSMWorld::ModifyCommand::redo()
|
||||
{
|
||||
mOld = mModel.data (mIndex, Qt::EditRole);
|
||||
mModel.setData (mIndex, mNew);
|
||||
mOld = mModel->data (mIndex, Qt::EditRole);
|
||||
mModel->setData (mIndex, mNew);
|
||||
}
|
||||
|
||||
void CSMWorld::ModifyCommand::undo()
|
||||
{
|
||||
mModel.setData (mIndex, mOld);
|
||||
mModel->setData (mIndex, mOld);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace CSMWorld
|
|||
|
||||
class ModifyCommand : public QUndoCommand
|
||||
{
|
||||
QAbstractItemModel& mModel;
|
||||
QAbstractItemModel *mModel;
|
||||
QModelIndex mIndex;
|
||||
QVariant mNew;
|
||||
QVariant mOld;
|
||||
|
|
|
@ -1363,7 +1363,13 @@ namespace CSMWorld
|
|||
std::vector<ESM::AIPackage>& list = actor.mAiPackage.mList;
|
||||
|
||||
ESM::AIPackage newRow;
|
||||
newRow.mType = ESM::AI_CNDT;
|
||||
newRow.mType = ESM::AI_Wander;
|
||||
newRow.mWander.mDistance = 0;
|
||||
newRow.mWander.mDuration = 0;
|
||||
newRow.mWander.mTimeOfDay = 0;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
newRow.mWander.mIdle[i] = 0;
|
||||
newRow.mWander.mShouldRepeat = 0;
|
||||
newRow.mCellName = "";
|
||||
|
||||
if (position >= (int)list.size())
|
||||
|
|
Loading…
Reference in a new issue