mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 10:19:55 +00:00
1b5301eec0
Conflicts: apps/openmw/mwbase/mechanicsmanager.hpp apps/openmw/mwbase/soundmanager.hpp apps/openmw/mwgui/mapwindow.hpp apps/openmw/mwmechanics/actors.cpp apps/openmw/mwmechanics/mechanicsmanagerimp.hpp apps/openmw/mwsound/soundmanagerimp.hpp components/esm/loadcell.cpp
51 lines
No EOL
1.4 KiB
C++
51 lines
No EOL
1.4 KiB
C++
|
|
#include "refcollection.hpp"
|
|
|
|
#include <sstream>
|
|
|
|
#include "ref.hpp"
|
|
#include "cell.hpp"
|
|
#include "universalid.hpp"
|
|
#include "record.hpp"
|
|
|
|
void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool base)
|
|
{
|
|
Record<Cell> cell = mCells.getRecord (cellIndex);
|
|
|
|
Cell& cell2 = base ? cell.mBase : cell.mModified;
|
|
|
|
CellRef ref;
|
|
|
|
bool deleted = false;
|
|
while (cell2.getNextRef (reader, ref, deleted))
|
|
{
|
|
/// \todo handle deleted and moved references
|
|
ref.load (reader, cell2, getNewId());
|
|
|
|
Record<CellRef> record2;
|
|
record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
|
(base ? record2.mBase : record2.mModified) = ref;
|
|
|
|
appendRecord (record2);
|
|
}
|
|
|
|
mCells.setRecord (cellIndex, cell);
|
|
}
|
|
|
|
std::string CSMWorld::RefCollection::getNewId()
|
|
{
|
|
std::ostringstream stream;
|
|
stream << "ref#" << mNextId++;
|
|
return stream.str();
|
|
}
|
|
|
|
void CSMWorld::RefCollection::cloneRecord(const std::string& origin,
|
|
const std::string& destination,
|
|
const CSMWorld::UniversalId::Type type,
|
|
const CSMWorld::UniversalId::ArgumentType argumentType)
|
|
{
|
|
Record<CSMWorld::CellRef> clone(getRecord(origin));
|
|
clone.mState = CSMWorld::RecordBase::State_ModifiedOnly;
|
|
clone.get().mId = destination;
|
|
insertRecord(clone, getAppendIndex(destination, type), type);
|
|
} |