mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge branch 'fix_remove_deleted_dialogue_info' into 'master'
Fix handling deleted DIAL records (#7397) Closes #7397 See merge request OpenMW/openmw!3097
This commit is contained in:
commit
25bbaa2343
@ -73,17 +73,18 @@ namespace CSMWorld
|
||||
|
||||
for (const OrderedInfo& info : topicInfoOrder->second.getOrderedInfo())
|
||||
{
|
||||
const Record<Info>& record = infoCollection.getRecord(info.mId);
|
||||
const ESM::RefId id = makeCompositeInfoRefId(dialogueId, info.mId);
|
||||
const Record<Info>& record = infoCollection.getRecord(id);
|
||||
|
||||
if (record.mState == RecordBase::State_ModifiedOnly)
|
||||
{
|
||||
erasedRecords.push_back(infoCollection.searchId(info.mId));
|
||||
erasedRecords.push_back(infoCollection.searchId(id));
|
||||
continue;
|
||||
}
|
||||
|
||||
auto deletedRecord = std::make_unique<Record<Info>>(record);
|
||||
deletedRecord->mState = RecordBase::State_Deleted;
|
||||
infoCollection.setRecord(infoCollection.searchId(info.mId), std::move(deletedRecord));
|
||||
infoCollection.setRecord(infoCollection.searchId(id), std::move(deletedRecord));
|
||||
}
|
||||
|
||||
while (!erasedRecords.empty())
|
||||
@ -91,8 +92,6 @@ namespace CSMWorld
|
||||
infoCollection.removeRows(erasedRecords.back(), 1);
|
||||
erasedRecords.pop_back();
|
||||
}
|
||||
|
||||
infoOrders.erase(topicInfoOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,16 @@ namespace CSMWorld
|
||||
{
|
||||
namespace
|
||||
{
|
||||
ESM::RefId makeCompositeRefId(const ESM::RefId& topicId, const ESM::RefId& infoId)
|
||||
{
|
||||
return ESM::RefId::stringRefId(topicId.getRefIdString() + '#' + infoId.getRefIdString());
|
||||
}
|
||||
|
||||
std::string_view getInfoTopicId(const ESM::RefId& infoId)
|
||||
{
|
||||
return parseInfoRefId(infoId).first;
|
||||
}
|
||||
}
|
||||
|
||||
ESM::RefId makeCompositeInfoRefId(const ESM::RefId& topicId, const ESM::RefId& infoId)
|
||||
{
|
||||
return ESM::RefId::stringRefId(topicId.getRefIdString() + '#' + infoId.getRefIdString());
|
||||
}
|
||||
}
|
||||
|
||||
void CSMWorld::InfoCollection::load(const Info& value, bool base)
|
||||
@ -65,7 +65,7 @@ void CSMWorld::InfoCollection::load(
|
||||
|
||||
info.load(reader, isDeleted);
|
||||
|
||||
const ESM::RefId id = makeCompositeRefId(dialogue.mId, info.mId);
|
||||
const ESM::RefId id = makeCompositeInfoRefId(dialogue.mId, info.mId);
|
||||
|
||||
if (isDeleted)
|
||||
{
|
||||
@ -107,7 +107,7 @@ void CSMWorld::InfoCollection::sort(const InfoOrderByTopic& infoOrders)
|
||||
order.reserve(getSize());
|
||||
for (const auto& [topicId, infoOrder] : infoOrders)
|
||||
for (const OrderedInfo& info : infoOrder.getOrderedInfo())
|
||||
order.push_back(getIndex(makeCompositeRefId(topicId, info.mId)));
|
||||
order.push_back(getIndex(makeCompositeInfoRefId(topicId, info.mId)));
|
||||
reorderRowsImp(order);
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,8 @@ namespace CSMWorld
|
||||
|
||||
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;
|
||||
};
|
||||
|
||||
ESM::RefId makeCompositeInfoRefId(const ESM::RefId& topicId, const ESM::RefId& infoId);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user