mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Fixed an issue with RefId in CellRefs where Ids wouldn't be loaded
Fixed multiple issues from the review.
This commit is contained in:
parent
42e45723b7
commit
6ff90b34a8
@ -253,12 +253,12 @@ void CSMDoc::CollectionReferencesStage::perform(int stage, Messages& messages)
|
||||
|
||||
if (record.isModified() || record.mState == CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
ESM::RefId cellId = record.get().mOriginalCell.empty() ? record.get().mCell : record.get().mOriginalCell;
|
||||
const ESM::RefId& cellId = record.get().mOriginalCell.empty() ? record.get().mCell : record.get().mOriginalCell;
|
||||
|
||||
std::deque<int>& indices = mState.getSubRecords()[cellId.getRefIdString()];
|
||||
|
||||
// collect moved references at the end of the container
|
||||
bool interior = cellId.getRefIdString().substr(0, 1) != "#";
|
||||
bool interior = cellId.getRefIdString()[0] != '#';
|
||||
std::ostringstream stream;
|
||||
if (!interior)
|
||||
{
|
||||
@ -362,7 +362,7 @@ void CSMDoc::WriteCellCollectionStage::perform(int stage, Messages& messages)
|
||||
|| references != mState.getSubRecords().end())
|
||||
{
|
||||
CSMWorld::Cell cellRecord = cell.get();
|
||||
bool interior = cellRecord.mId.getRefIdString().substr(0, 1) != "#";
|
||||
bool interior = cellRecord.mId.getRefIdString()[0] != '#';
|
||||
|
||||
// count new references and adjust RefNumCount accordingsly
|
||||
unsigned int newRefNum = cellRecord.mRefNumCounter;
|
||||
@ -447,7 +447,7 @@ void CSMDoc::WritePathgridCollectionStage::perform(int stage, Messages& messages
|
||||
{
|
||||
CSMWorld::Pathgrid record = pathgrid.get();
|
||||
std::string recordIdString = record.mId.getRefIdString();
|
||||
if (recordIdString.substr(0, 1) == "#")
|
||||
if (recordIdString[0] == '#')
|
||||
{
|
||||
std::istringstream stream(recordIdString.c_str());
|
||||
char ignore;
|
||||
|
@ -35,7 +35,7 @@ void CSMTools::StartScriptCheckStage::perform(int stage, CSMDoc::Messages& messa
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
auto scriptId = record.get().mId;
|
||||
const auto& scriptId = record.get().mId;
|
||||
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_StartScript, scriptId);
|
||||
|
||||
|
@ -77,11 +77,14 @@ CSMDoc::OperationHolder* CSMTools::Tools::getVerifier()
|
||||
connect(&mVerifier, &CSMDoc::OperationHolder::done, this, &Tools::done);
|
||||
connect(&mVerifier, &CSMDoc::OperationHolder::reportMessage, this, &Tools::verifierMessage);
|
||||
|
||||
std::vector<std::string> mandatoryIds{ "Day", "DaysPassed", "GameHour", "Month", "PCRace" };
|
||||
|
||||
std::vector<ESM::RefId> mandatoryRefIds;
|
||||
for (auto& id : mandatoryIds)
|
||||
mandatoryRefIds.push_back(ESM::RefId::stringRefId(id));
|
||||
{
|
||||
auto mandatoryIds = { "Day", "DaysPassed", "GameHour", "Month", "PCRace" };
|
||||
for (auto& id : mandatoryIds)
|
||||
mandatoryRefIds.push_back(ESM::RefId::stringRefId(id));
|
||||
}
|
||||
|
||||
|
||||
mVerifierOperation->appendStage(new MandatoryIdStage(
|
||||
mData.getGlobals(), CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Globals), mandatoryRefIds));
|
||||
|
@ -143,12 +143,12 @@ int CSMWorld::InfoCollection::getInsertIndex(const std::string& id, UniversalId:
|
||||
int index = -1;
|
||||
|
||||
const Info& info = static_cast<Record<Info>*>(record)->get();
|
||||
auto topic = info.mTopicId;
|
||||
const std::string& topic = info.mTopicId.getRefIdString();
|
||||
|
||||
// if the record has a prev, find its index value
|
||||
if (!info.mPrev.empty())
|
||||
{
|
||||
index = getInfoIndex(info.mPrev.getRefIdString(), topic.getRefIdString());
|
||||
index = getInfoIndex(info.mPrev.getRefIdString(), topic);
|
||||
|
||||
if (index != -1)
|
||||
++index; // if prev exists, set current index to one above prev
|
||||
@ -158,13 +158,13 @@ int CSMWorld::InfoCollection::getInsertIndex(const std::string& id, UniversalId:
|
||||
if (index == -1 && !info.mNext.empty())
|
||||
{
|
||||
// if next exists, use its index as the current index
|
||||
index = getInfoIndex(info.mNext.getRefIdString(), topic.getRefIdString());
|
||||
index = getInfoIndex(info.mNext.getRefIdString(), topic);
|
||||
}
|
||||
|
||||
// if next doesn't exist or not found (i.e. neither exist yet) then start a new one
|
||||
if (index == -1)
|
||||
{
|
||||
Range range = getTopicRange(topic.getRefIdString()); // getTopicRange converts topic to lower case first
|
||||
Range range = getTopicRange(topic); // getTopicRange converts topic to lower case first
|
||||
|
||||
index = std::distance(getRecords().begin(), range.second);
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ CSVRender::WorldspaceWidget::DropType CSVRender::WorldspaceWidget::getDropType(
|
||||
if (iter->getType() == CSMWorld::UniversalId::Type_Cell
|
||||
|| iter->getType() == CSMWorld::UniversalId::Type_Cell_Missing)
|
||||
{
|
||||
type = iter->getId().substr(0, 1) == "#" ? Type_CellsExterior : Type_CellsInterior;
|
||||
type = iter->getId()[0] == '#' ? Type_CellsExterior : Type_CellsInterior;
|
||||
}
|
||||
else if (iter->getType() == CSMWorld::UniversalId::Type_DebugProfile)
|
||||
type = Type_DebugProfile;
|
||||
|
@ -41,7 +41,7 @@ namespace ESM
|
||||
template <bool load>
|
||||
void loadDataImpl(ESMReader& esm, bool& isDeleted, CellRef& cellRef)
|
||||
{
|
||||
const auto getRefIdOrSkip = [&](ESM::RefId refId) {
|
||||
const auto getRefIdOrSkip = [&](ESM::RefId& refId) {
|
||||
if constexpr (load)
|
||||
refId = esm.getRefId();
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user