1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 12:06:43 +00:00

Merge branch 'dialogclonefix' into 'master'

[OpenMW-CS] Fix cloning in info records

See merge request OpenMW/openmw!524
This commit is contained in:
psi29a 2021-01-11 14:13:53 +00:00
commit acfd2cfd90
5 changed files with 32 additions and 5 deletions

View file

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

View file

@ -35,6 +35,7 @@ Bug Fixes:
Editor Bug Fixes: Editor Bug Fixes:
- Deleted and moved objects within a cell are now saved properly (#832) - 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) - Verifier no longer checks for alleged 'race' entries in clothing body parts (#5400)
- Loading mods now keeps the master index (#5675) - Loading mods now keeps the master index (#5675)
- Flicker and crashing on XFCE4 fixed (#5703) - Flicker and crashing on XFCE4 fixed (#5703)

View file

@ -397,6 +397,10 @@ void CSMWorld::CloneCommand::redo()
{ {
mModel.cloneRecord (mIdOrigin, mId, mType); mModel.cloneRecord (mIdOrigin, mId, mType);
applyModifications(); applyModifications();
for (auto& value : mOverrideValues)
{
mModel.setData(mModel.getModelIndex (mId, value.first), value.second);
}
} }
void CSMWorld::CloneCommand::undo() void CSMWorld::CloneCommand::undo()
@ -404,6 +408,11 @@ void CSMWorld::CloneCommand::undo()
mModel.removeRow (mModel.getModelIndex (mId, 0).row()); 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) CSMWorld::CreatePathgridCommand::CreatePathgridCommand(IdTable& model, const std::string& id, QUndoCommand *parent)
: CreateCommand(model, id, parent) : CreateCommand(model, id, parent)
{ {

View file

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

View file

@ -34,7 +34,10 @@ void CSVWorld::InfoCreator::configureCreateCommand (CSMWorld::CreateCommand& com
{ {
CSMWorld::IdTable& table = dynamic_cast<CSMWorld::IdTable&> (*getData().getTableModel (getCollectionId())); CSMWorld::IdTable& table = dynamic_cast<CSMWorld::IdTable&> (*getData().getTableModel (getCollectionId()));
CSMWorld::CloneCommand* cloneCommand = dynamic_cast<CSMWorld::CloneCommand*> (&command);
if (getCollectionId() == CSMWorld::UniversalId::Type_TopicInfos) if (getCollectionId() == CSMWorld::UniversalId::Type_TopicInfos)
{
if (!cloneCommand)
{ {
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Topic), mTopic->text()); 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_Rank), -1);
@ -42,9 +45,19 @@ void CSVWorld::InfoCreator::configureCreateCommand (CSMWorld::CreateCommand& com
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_PcRank), -1); command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_PcRank), -1);
} }
else else
{
cloneCommand->setOverrideValue(table.findColumnIndex(CSMWorld::Columns::ColumnId_Topic), mTopic->text());
}
}
else
{
if (!cloneCommand)
{ {
command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text()); command.addValue (table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text());
} }
else
cloneCommand->setOverrideValue(table.findColumnIndex(CSMWorld::Columns::ColumnId_Journal), mTopic->text());
}
} }
CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack, CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack,