Merge branch 'dialogclonefix' into 'master'

[OpenMW-CS] Fix cloning in info records

See merge request OpenMW/openmw!524
pull/593/head
psi29a 4 years ago
commit acfd2cfd90

@ -22,6 +22,7 @@
Bug #4055: Local scripts don't inherit variables from their base record
Bug #4083: Door animation freezes when colliding with actors
Bug #4247: Cannot walk up stairs in Ebonheart docks
Bug #4363: Editor: Defect in Clone Function for Dialogue Info records
Bug #4447: Actor collision capsule shape allows looking through some walls
Bug #4465: Collision shape overlapping causes twitching
Bug #4476: Abot Gondoliers: player hangs in air during scenic travel

@ -35,6 +35,7 @@ Bug Fixes:
Editor Bug Fixes:
- Deleted and moved objects within a cell are now saved properly (#832)
- Topic and Journal Info records can now be cloned with a different parent Topic/Journal Id (#4363)
- Verifier no longer checks for alleged 'race' entries in clothing body parts (#5400)
- Loading mods now keeps the master index (#5675)
- Flicker and crashing on XFCE4 fixed (#5703)

@ -397,6 +397,10 @@ void CSMWorld::CloneCommand::redo()
{
mModel.cloneRecord (mIdOrigin, mId, mType);
applyModifications();
for (auto& value : mOverrideValues)
{
mModel.setData(mModel.getModelIndex (mId, value.first), value.second);
}
}
void CSMWorld::CloneCommand::undo()
@ -404,6 +408,11 @@ void CSMWorld::CloneCommand::undo()
mModel.removeRow (mModel.getModelIndex (mId, 0).row());
}
void CSMWorld::CloneCommand::setOverrideValue(int column, QVariant value)
{
mOverrideValues.emplace_back(std::make_pair(column, value));
}
CSMWorld::CreatePathgridCommand::CreatePathgridCommand(IdTable& model, const std::string& id, QUndoCommand *parent)
: CreateCommand(model, id, parent)
{

@ -183,6 +183,7 @@ namespace CSMWorld
class CloneCommand : public CreateCommand
{
std::string mIdOrigin;
std::vector<std::pair<int, QVariant>> mOverrideValues;
public:
@ -194,6 +195,8 @@ namespace CSMWorld
void redo() override;
void undo() override;
void setOverrideValue(int column, QVariant value);
};
class RevertCommand : public QUndoCommand

@ -34,16 +34,29 @@ void CSVWorld::InfoCreator::configureCreateCommand (CSMWorld::CreateCommand& com
{
CSMWorld::IdTable& table = dynamic_cast<CSMWorld::IdTable&> (*getData().getTableModel (getCollectionId()));
CSMWorld::CloneCommand* cloneCommand = dynamic_cast<CSMWorld::CloneCommand*> (&command);
if (getCollectionId() == CSMWorld::UniversalId::Type_TopicInfos)
{
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Topic), mTopic->text());
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Rank), -1);
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Gender), -1);
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_PcRank), -1);
if (!cloneCommand)
{
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Topic), mTopic->text());
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Rank), -1);
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Gender), -1);
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_PcRank), -1);
}
else
{
cloneCommand->setOverrideValue(table.findColumnIndex(CSMWorld::Columns::ColumnId_Topic), mTopic->text());
}
}
else
{
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text());
if (!cloneCommand)
{
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text());
}
else
cloneCommand->setOverrideValue(table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text());
}
}

Loading…
Cancel
Save