mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 23:36:41 +00:00
Replace new with make_unique in opencs
This commit is contained in:
parent
3c83117e99
commit
db1a372e5b
22 changed files with 86 additions and 92 deletions
|
@ -116,7 +116,7 @@ void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
|
|||
{
|
||||
if (getData().getGmsts().searchId (gmst.mId)==-1)
|
||||
{
|
||||
std::unique_ptr<CSMWorld::Record<ESM::GameSetting> > record(new CSMWorld::Record<ESM::GameSetting>);
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::GameSetting>>();
|
||||
record->mBase = gmst;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
getData().getGmsts().appendRecord (std::move(record));
|
||||
|
@ -127,7 +127,7 @@ void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
|
|||
{
|
||||
if (getData().getGlobals().searchId (global.mId)==-1)
|
||||
{
|
||||
std::unique_ptr<CSMWorld::Record<ESM::Global> > record(new CSMWorld::Record<ESM::Global>);
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::Global>>();
|
||||
record->mBase = global;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
getData().getGlobals().appendRecord (std::move(record));
|
||||
|
@ -138,7 +138,7 @@ void CSMDoc::Document::addOptionalMagicEffect (const ESM::MagicEffect& magicEffe
|
|||
{
|
||||
if (getData().getMagicEffects().searchId (magicEffect.mId)==-1)
|
||||
{
|
||||
std::unique_ptr<CSMWorld::Record<ESM::MagicEffect> > record(new CSMWorld::Record<ESM::MagicEffect>);
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::MagicEffect>>();
|
||||
record->mBase = magicEffect;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
getData().getMagicEffects().appendRecord (std::move(record));
|
||||
|
|
|
@ -579,7 +579,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined)
|
|||
else
|
||||
{
|
||||
// Empty filter string equals to filter "true".
|
||||
mFilter.reset (new BooleanNode (true));
|
||||
mFilter = std::make_shared<BooleanNode>(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace CSMWorld
|
|||
}
|
||||
|
||||
// Create the actor data
|
||||
data.reset(new ActorData());
|
||||
data = std::make_shared<ActorData>();
|
||||
setupActor(id, data);
|
||||
mCachedActors.insert(id, data);
|
||||
return data;
|
||||
|
@ -431,7 +431,7 @@ namespace CSMWorld
|
|||
if (data) return data;
|
||||
|
||||
// Create the race data
|
||||
data.reset(new RaceData());
|
||||
data = std::make_shared<RaceData>();
|
||||
setupRace(id, data);
|
||||
mCachedRaces.insert(id, data);
|
||||
return data;
|
||||
|
|
|
@ -249,12 +249,13 @@ namespace CSMWorld
|
|||
int Collection<ESXRecordT, IdAccessorT>::cloneRecordImp(const std::string& origin,
|
||||
const std::string& destination, UniversalId::Type type)
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > copy(new Record<ESXRecordT>);
|
||||
copy->mModified = getRecord(origin).get();
|
||||
copy->mState = RecordBase::State_ModifiedOnly;
|
||||
IdAccessorT().setId(copy->get(), destination);
|
||||
auto copy = std::make_unique<Record<ESXRecordT>>();
|
||||
copy->mModified = getRecord(origin).get();
|
||||
copy->mState = RecordBase::State_ModifiedOnly;
|
||||
IdAccessorT().setId(copy->get(), destination);
|
||||
|
||||
if (type == UniversalId::Type_Reference) {
|
||||
if (type == UniversalId::Type_Reference)
|
||||
{
|
||||
CSMWorld::CellRef* ptr = (CSMWorld::CellRef*) ©->mModified;
|
||||
ptr->mRefNum.mIndex = 0;
|
||||
}
|
||||
|
@ -338,7 +339,7 @@ namespace CSMWorld
|
|||
|
||||
if (iter==mIndex.end())
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record2(new Record<ESXRecordT>);
|
||||
auto record2 = std::make_unique<Record<ESXRecordT>>();
|
||||
record2->mState = Record<ESXRecordT>::State_ModifiedOnly;
|
||||
record2->mModified = record;
|
||||
|
||||
|
@ -469,7 +470,7 @@ namespace CSMWorld
|
|||
IdAccessorT().setId(record, id);
|
||||
record.blank();
|
||||
|
||||
std::unique_ptr<Record<ESXRecordT> > record2(new Record<ESXRecordT>);
|
||||
auto record2 = std::make_unique<Record<ESXRecordT>>();
|
||||
record2->mState = Record<ESXRecordT>::State_ModifiedOnly;
|
||||
record2->mModified = record;
|
||||
|
||||
|
|
|
@ -170,14 +170,13 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
|
|||
if (cellId.find ('#')!=std::string::npos)
|
||||
{
|
||||
// Need to recalculate the cell
|
||||
modifyCell.reset (new UpdateCellCommand (model2, row));
|
||||
modifyCell = std::make_unique<UpdateCellCommand>(model2, row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<CSMWorld::ModifyCommand> modifyData (
|
||||
new CSMWorld::ModifyCommand (*model, index, new_));
|
||||
auto modifyData = std::make_unique<CSMWorld::ModifyCommand>(*model, index, new_);
|
||||
|
||||
if (modifyCell.get())
|
||||
{
|
||||
|
|
|
@ -70,11 +70,11 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::Pat
|
|||
mReader (nullptr), mDialogue (nullptr), mReaderIndex(1),
|
||||
mFsStrict(fsStrict), mDataPaths(dataPaths), mArchives(archives)
|
||||
{
|
||||
mVFS.reset(new VFS::Manager(mFsStrict));
|
||||
mVFS = std::make_unique<VFS::Manager>(mFsStrict);
|
||||
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true);
|
||||
|
||||
mResourcesManager.setVFS(mVFS.get());
|
||||
mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get()));
|
||||
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
|
||||
|
||||
Shader::ShaderManager::DefineMap defines = mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines();
|
||||
Shader::ShaderManager::DefineMap shadowDefines = SceneUtil::ShadowManager::getShadowsDisabledDefines();
|
||||
|
@ -602,7 +602,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::Pat
|
|||
UniversalId::Type_Video);
|
||||
addModel (new IdTable (&mMetaData), UniversalId::Type_MetaData);
|
||||
|
||||
mActorAdapter.reset(new ActorAdapter(*this));
|
||||
mActorAdapter = std::make_unique<ActorAdapter>(*this);
|
||||
|
||||
mRefLoadCache.clear(); // clear here rather than startLoading() and continueLoading() for multiple content files
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ int CSMWorld::Data::getTotalRecords (const std::vector<boost::filesystem::path>&
|
|||
{
|
||||
int records = 0;
|
||||
|
||||
std::unique_ptr<ESM::ESMReader> reader = std::unique_ptr<ESM::ESMReader>(new ESM::ESMReader);
|
||||
std::unique_ptr<ESM::ESMReader> reader = std::make_unique<ESM::ESMReader>();
|
||||
|
||||
for (unsigned int i = 0; i < files.size(); ++i)
|
||||
{
|
||||
|
@ -1032,7 +1032,7 @@ void CSMWorld::Data::loadFallbackEntries()
|
|||
ESM::Static newMarker;
|
||||
newMarker.mId = marker.first;
|
||||
newMarker.mModel = marker.second;
|
||||
std::unique_ptr<CSMWorld::Record<ESM::Static> > record(new CSMWorld::Record<ESM::Static>);
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::Static>>();
|
||||
record->mBase = newMarker;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
mReferenceables.appendRecord (std::move(record), CSMWorld::UniversalId::Type_Static);
|
||||
|
@ -1046,7 +1046,7 @@ void CSMWorld::Data::loadFallbackEntries()
|
|||
ESM::Door newMarker;
|
||||
newMarker.mId = marker.first;
|
||||
newMarker.mModel = marker.second;
|
||||
std::unique_ptr<CSMWorld::Record<ESM::Door> > record(new CSMWorld::Record<ESM::Door>);
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::Door>>();
|
||||
record->mBase = newMarker;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
mReferenceables.appendRecord (std::move(record), CSMWorld::UniversalId::Type_Door);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace CSMWorld
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<Record<Pathgrid> > baseRecord(new Record<Pathgrid>(this->getRecord(index)));
|
||||
auto baseRecord = std::make_unique<Record<Pathgrid>>(this->getRecord(index));
|
||||
baseRecord->mState = RecordBase::State_Deleted;
|
||||
this->setRecord(index, std::move(baseRecord));
|
||||
return index;
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace CSMWorld
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<Record<ESXRecordT> > baseRecord(new Record<ESXRecordT>(this->getRecord(index)));
|
||||
auto baseRecord = std::make_unique<Record<ESXRecordT>>(this->getRecord(index));
|
||||
baseRecord->mState = RecordBase::State_Deleted;
|
||||
this->setRecord(index, std::move(baseRecord));
|
||||
return index;
|
||||
|
@ -103,7 +103,7 @@ namespace CSMWorld
|
|||
if (index==-1)
|
||||
{
|
||||
// new record
|
||||
std::unique_ptr<Record<ESXRecordT> > record2(new Record<ESXRecordT>);
|
||||
auto record2 = std::make_unique<Record<ESXRecordT>>();
|
||||
record2->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
(base ? record2->mBase : record2->mModified) = record;
|
||||
|
||||
|
@ -113,8 +113,7 @@ namespace CSMWorld
|
|||
else
|
||||
{
|
||||
// old record
|
||||
std::unique_ptr<Record<ESXRecordT> > record2(
|
||||
new Record<ESXRecordT>(Collection<ESXRecordT, IdAccessorT>::getRecord(index)));
|
||||
auto record2 = std::make_unique<Record<ESXRecordT>>(Collection<ESXRecordT, IdAccessorT>::getRecord(index));
|
||||
|
||||
if (base)
|
||||
record2->mBase = record;
|
||||
|
@ -146,8 +145,7 @@ namespace CSMWorld
|
|||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record2(
|
||||
new Record<ESXRecordT>(Collection<ESXRecordT, IdAccessorT>::getRecord(index)));
|
||||
auto record2 = std::make_unique<Record<ESXRecordT>>(Collection<ESXRecordT, IdAccessorT>::getRecord(index));
|
||||
record2->mState = RecordBase::State_Deleted;
|
||||
this->setRecord(index, std::move(record2));
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
|||
if (index==-1)
|
||||
{
|
||||
// new record
|
||||
std::unique_ptr<Record<Info> > record2(new Record<Info>);
|
||||
auto record2 = std::make_unique<Record<Info>>();
|
||||
record2->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
(base ? record2->mBase : record2->mModified) = record;
|
||||
|
||||
|
@ -86,7 +86,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
|||
else
|
||||
{
|
||||
// old record
|
||||
std::unique_ptr<Record<Info> > record2(new Record<Info>(getRecord(index)));
|
||||
auto record2 = std::make_unique<Record<Info>>(getRecord(index));
|
||||
|
||||
if (base)
|
||||
record2->mBase = record;
|
||||
|
@ -220,7 +220,7 @@ void CSMWorld::InfoCollection::load (ESM::ESMReader& reader, bool base, const ES
|
|||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record(new Record<Info>(getRecord(index)));
|
||||
auto record = std::make_unique<Record<Info>>(getRecord(index));
|
||||
record->mState = RecordBase::State_Deleted;
|
||||
setRecord (index, std::move(record));
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void CSMWorld::InfoCollection::removeDialogueInfos(const std::string& dialogueId
|
|||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record2(new Record<Info>(record));
|
||||
auto record2 = std::make_unique<Record<Info>>(record);
|
||||
record2->mState = RecordBase::State_Deleted;
|
||||
setRecord(range.first - getRecords().begin(), std::move(record2));
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void CSMWorld::InfoCollection::removeRows (int index, int count)
|
|||
|
||||
void CSMWorld::InfoCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record2(new Record<Info>);
|
||||
auto record2 = std::make_unique<Record<Info>>();
|
||||
|
||||
record2->mState = Record<Info>::State_ModifiedOnly;
|
||||
record2->mModified.blank();
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void NestedIdCollection<ESXRecordT, IdAccessorT>::addNestedRow(int row, int column, int position)
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record(new Record<ESXRecordT>);
|
||||
auto record = std::make_unique<Record<ESXRecordT>>();
|
||||
record->assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
|
||||
|
||||
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).addRow(*record, position);
|
||||
|
@ -101,7 +101,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void NestedIdCollection<ESXRecordT, IdAccessorT>::removeNestedRows(int row, int column, int subRow)
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record(new Record<ESXRecordT>);
|
||||
auto record = std::make_unique<Record<ESXRecordT>>();
|
||||
record->assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
|
||||
|
||||
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).removeRow(*record, subRow);
|
||||
|
@ -121,7 +121,7 @@ namespace CSMWorld
|
|||
void NestedIdCollection<ESXRecordT, IdAccessorT>::setNestedData(int row,
|
||||
int column, const QVariant& data, int subRow, int subColumn)
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record(new Record<ESXRecordT>);
|
||||
auto record = std::make_unique<Record<ESXRecordT>>();
|
||||
record->assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
|
||||
|
||||
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).setData(
|
||||
|
@ -142,7 +142,7 @@ namespace CSMWorld
|
|||
void NestedIdCollection<ESXRecordT, IdAccessorT>::setNestedTable(int row,
|
||||
int column, const CSMWorld::NestedTableWrapperBase& nestedTable)
|
||||
{
|
||||
std::unique_ptr<Record<ESXRecordT> > record(new Record<ESXRecordT>);
|
||||
auto record = std::make_unique<Record<ESXRecordT>>();
|
||||
record->assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
|
||||
|
||||
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).setTable(
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace CSMWorld
|
|||
|
||||
void NestedInfoCollection::addNestedRow(int row, int column, int position)
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record(new Record<Info>);
|
||||
auto record = std::make_unique<Record<Info>>();
|
||||
record->assign(Collection<Info, IdAccessor<Info> >::getRecord(row));
|
||||
|
||||
getAdapter(Collection<Info, IdAccessor<Info> >::getColumn(column)).addRow(*record, position);
|
||||
|
@ -45,7 +45,7 @@ namespace CSMWorld
|
|||
|
||||
void NestedInfoCollection::removeNestedRows(int row, int column, int subRow)
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record(new Record<Info>);
|
||||
auto record = std::make_unique<Record<Info>>();
|
||||
record->assign(Collection<Info, IdAccessor<Info> >::getRecord(row));
|
||||
|
||||
getAdapter(Collection<Info, IdAccessor<Info> >::getColumn(column)).removeRow(*record, subRow);
|
||||
|
@ -63,7 +63,7 @@ namespace CSMWorld
|
|||
void NestedInfoCollection::setNestedData(int row,
|
||||
int column, const QVariant& data, int subRow, int subColumn)
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record(new Record<Info>);
|
||||
auto record = std::make_unique<Record<Info>>();
|
||||
record->assign(Collection<Info, IdAccessor<Info> >::getRecord(row));
|
||||
|
||||
getAdapter(Collection<Info, IdAccessor<Info> >::getColumn(column)).setData(
|
||||
|
@ -82,7 +82,7 @@ namespace CSMWorld
|
|||
void NestedInfoCollection::setNestedTable(int row,
|
||||
int column, const CSMWorld::NestedTableWrapperBase& nestedTable)
|
||||
{
|
||||
std::unique_ptr<Record<Info> > record(new Record<Info>);
|
||||
auto record = std::make_unique<Record<Info>>();
|
||||
record->assign(Collection<Info, IdAccessor<Info> >::getRecord(row));
|
||||
|
||||
getAdapter(Collection<Info, IdAccessor<Info> >::getColumn(column)).setTable(
|
||||
|
|
|
@ -123,7 +123,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
ref.mId = getRecord(index).get().mId;
|
||||
ref.mIdNum = extractIdNum(ref.mId);
|
||||
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>);
|
||||
auto record = std::make_unique<Record<CellRef>>();
|
||||
// TODO: check whether a base record be moved
|
||||
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
(base ? record->mBase : record->mModified) = std::move(ref);
|
||||
|
@ -158,7 +158,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>(getRecord(index)));
|
||||
auto record = std::make_unique<Record<CellRef>>(getRecord(index));
|
||||
record->mState = RecordBase::State_Deleted;
|
||||
setRecord(index, std::move(record));
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
|
||||
cache.emplace(refNum, ref.mIdNum);
|
||||
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>);
|
||||
auto record = std::make_unique<Record<CellRef>>();
|
||||
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
(base ? record->mBase : record->mModified) = std::move(ref);
|
||||
|
||||
|
@ -205,7 +205,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
ref.mId = getRecord(index).get().mId;
|
||||
ref.mIdNum = extractIdNum(ref.mId);
|
||||
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>(getRecord(index)));
|
||||
auto record = std::make_unique<Record<CellRef>>(getRecord(index));
|
||||
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_Modified;
|
||||
(base ? record->mBase : record->mModified) = std::move(ref);
|
||||
|
||||
|
@ -273,7 +273,7 @@ void CSMWorld::RefCollection::removeRows (int index, int count)
|
|||
|
||||
void CSMWorld::RefCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
||||
{
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>);
|
||||
auto record = std::make_unique<Record<CellRef>>();
|
||||
|
||||
record->mState = Record<CellRef>::State_ModifiedOnly;
|
||||
record->mModified.blank();
|
||||
|
@ -288,15 +288,15 @@ void CSMWorld::RefCollection::cloneRecord (const std::string& origin,
|
|||
const std::string& destination,
|
||||
const UniversalId::Type type)
|
||||
{
|
||||
std::unique_ptr<Record<CellRef> > copy(new Record<CellRef>);
|
||||
auto copy = std::make_unique<Record<CellRef>>();
|
||||
|
||||
copy->mModified = getRecord(origin).get();
|
||||
copy->mState = RecordBase::State_ModifiedOnly;
|
||||
copy->mModified = getRecord(origin).get();
|
||||
copy->mState = RecordBase::State_ModifiedOnly;
|
||||
|
||||
copy->get().mId = destination;
|
||||
copy->get().mIdNum = extractIdNum(destination);
|
||||
copy->get().mId = destination;
|
||||
copy->get().mIdNum = extractIdNum(destination);
|
||||
|
||||
insertRecord(std::move(copy), getAppendIndex(destination, type)); // call RefCollection::insertRecord()
|
||||
insertRecord(std::move(copy), getAppendIndex(destination, type)); // call RefCollection::insertRecord()
|
||||
}
|
||||
|
||||
int CSMWorld::RefCollection::searchId(std::string_view id) const
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace CSMWorld
|
|||
template<typename RecordT>
|
||||
void RefIdDataContainer<RecordT>::appendRecord (const std::string& id, bool base)
|
||||
{
|
||||
std::unique_ptr<Record<RecordT> > record(new Record<RecordT>);
|
||||
auto record = std::make_unique<Record<RecordT>>();
|
||||
|
||||
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
|
|||
{
|
||||
std::string id = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mId);
|
||||
|
||||
std::unique_ptr<Object> object (new Object (mData, mCellNode, id, false));
|
||||
auto object = std::make_unique<Object>(mData, mCellNode, id, false);
|
||||
|
||||
if (mSubModeElementMask & Mask_Reference)
|
||||
object->setSubMode (mSubMode);
|
||||
|
@ -128,14 +128,14 @@ void CSVRender::Cell::updateLand()
|
|||
}
|
||||
else
|
||||
{
|
||||
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode,
|
||||
mData.getResourceSystem().get(), mTerrainStorage, Mask_Terrain));
|
||||
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode,
|
||||
mData.getResourceSystem().get(), mTerrainStorage, Mask_Terrain);
|
||||
}
|
||||
|
||||
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
||||
|
||||
if (!mCellBorder)
|
||||
mCellBorder.reset(new CellBorder(mCellNode, mCoordinates));
|
||||
mCellBorder = std::make_unique<CellBorder>(mCellNode, mCoordinates);
|
||||
|
||||
mCellBorder->buildShape(esmLand);
|
||||
|
||||
|
@ -186,8 +186,8 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
|
|||
|
||||
updateLand();
|
||||
|
||||
mPathgrid.reset(new Pathgrid(mData, mCellNode, mId, mCoordinates));
|
||||
mCellWater.reset(new CellWater(mData, mCellNode, mId, mCoordinates));
|
||||
mPathgrid = std::make_unique<Pathgrid>(mData, mCellNode, mId, mCoordinates);
|
||||
mCellWater = std::make_unique<CellWater>(mData, mCellNode, mId, mCoordinates);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ void CSVRender::Cell::setCellArrows (int mask)
|
|||
if (enable!=(mCellArrows[i].get()!=nullptr))
|
||||
{
|
||||
if (enable)
|
||||
mCellArrows[i].reset (new CellArrow (mCellNode, direction, mCoordinates));
|
||||
mCellArrows[i] = std::make_unique<CellArrow>(mCellNode, direction, mCoordinates);
|
||||
else
|
||||
mCellArrows[i].reset (nullptr);
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ void CSVRender::Cell::setCellMarker()
|
|||
}
|
||||
|
||||
if (!isInteriorCell) {
|
||||
mCellMarker.reset(new CellMarker(mCellNode, mCoordinates, cellExists));
|
||||
mCellMarker = std::make_unique<CellMarker>(mCellNode, mCoordinates, cellExists);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ void CSVRender::Object::update()
|
|||
{
|
||||
if (recordType == CSMWorld::UniversalId::Type_Npc || recordType == CSMWorld::UniversalId::Type_Creature)
|
||||
{
|
||||
if (!mActor) mActor.reset(new Actor(mReferenceableId, mData));
|
||||
if (!mActor) mActor = std::make_unique<Actor>(mReferenceableId, mData);
|
||||
mActor->update();
|
||||
mBaseNode->addChild(mActor->getBaseNode());
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
|||
{
|
||||
modified = true;
|
||||
|
||||
std::unique_ptr<Cell> cell (new Cell (mDocument.getData(), mRootNode,
|
||||
iter->first.getId (mWorldspace), deleted));
|
||||
auto cell = std::make_unique<Cell>(mDocument.getData(), mRootNode,
|
||||
iter->first.getId (mWorldspace), deleted);
|
||||
|
||||
delete iter->second;
|
||||
iter->second = cell.release();
|
||||
|
@ -443,9 +443,7 @@ void CSVRender::PagedWorldspaceWidget::addCellToScene (
|
|||
bool deleted = index==-1 ||
|
||||
cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted;
|
||||
|
||||
std::unique_ptr<Cell> cell (
|
||||
new Cell (mDocument.getData(), mRootNode, coordinates.getId (mWorldspace),
|
||||
deleted));
|
||||
auto cell = std::make_unique<Cell>(mDocument.getData(), mRootNode, coordinates.getId (mWorldspace), deleted);
|
||||
EditMode *editMode = getEditMode();
|
||||
cell->setSubMode (editMode->getSubMode(), editMode->getInteractionMask());
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void CSVRender::TerrainShapeMode::activate(CSVWidget::SceneToolbar* toolbar)
|
|||
{
|
||||
if (!mTerrainShapeSelection)
|
||||
{
|
||||
mTerrainShapeSelection.reset(new TerrainSelection(mParentNode, &getWorldspaceWidget(), TerrainSelectionType::Shape));
|
||||
mTerrainShapeSelection = std::make_shared<TerrainSelection>(mParentNode, &getWorldspaceWidget(), TerrainSelectionType::Shape);
|
||||
}
|
||||
|
||||
if(!mShapeBrushScenetool)
|
||||
|
@ -56,7 +56,7 @@ void CSVRender::TerrainShapeMode::activate(CSVWidget::SceneToolbar* toolbar)
|
|||
}
|
||||
|
||||
if (!mBrushDraw)
|
||||
mBrushDraw.reset(new BrushDraw(mParentNode));
|
||||
mBrushDraw = std::make_unique<BrushDraw>(mParentNode);
|
||||
|
||||
EditMode::activate(toolbar);
|
||||
toolbar->addTool (mShapeBrushScenetool);
|
||||
|
@ -956,15 +956,15 @@ bool CSVRender::TerrainShapeMode::limitAlteredHeights(const CSMWorld::CellCoordi
|
|||
|
||||
// Check for height limits on x-axis
|
||||
if (leftHeight - thisHeight > limitHeightChange)
|
||||
limitedAlteredHeightXAxis.reset(new float(leftHeight - limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightXAxis = std::make_unique<float>(leftHeight - limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
else if (leftHeight - thisHeight < -limitHeightChange)
|
||||
limitedAlteredHeightXAxis.reset(new float(leftHeight + limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightXAxis = std::make_unique<float>(leftHeight + limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
|
||||
// Check for height limits on y-axis
|
||||
if (upHeight - thisHeight > limitHeightChange)
|
||||
limitedAlteredHeightYAxis.reset(new float(upHeight - limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightYAxis = std::make_unique<float>(upHeight - limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
else if (upHeight - thisHeight < -limitHeightChange)
|
||||
limitedAlteredHeightYAxis.reset(new float(upHeight + limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightYAxis = std::make_unique<float>(upHeight + limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
|
||||
// Limit altered height value based on x or y, whichever is the smallest
|
||||
compareAndLimit(cellCoords, inCellX, inCellY, limitedAlteredHeightXAxis.get(), limitedAlteredHeightYAxis.get(), &steepnessIsWithinLimits);
|
||||
|
@ -985,15 +985,15 @@ bool CSVRender::TerrainShapeMode::limitAlteredHeights(const CSMWorld::CellCoordi
|
|||
|
||||
// Check for height limits on x-axis
|
||||
if (rightHeight - thisHeight > limitHeightChange)
|
||||
limitedAlteredHeightXAxis.reset(new float(rightHeight - limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightXAxis = std::make_unique<float>(rightHeight - limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
else if (rightHeight - thisHeight < -limitHeightChange)
|
||||
limitedAlteredHeightXAxis.reset(new float(rightHeight + limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightXAxis = std::make_unique<float>(rightHeight + limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
|
||||
// Check for height limits on y-axis
|
||||
if (downHeight - thisHeight > limitHeightChange)
|
||||
limitedAlteredHeightYAxis.reset(new float(downHeight - limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightYAxis = std::make_unique<float>(downHeight - limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
else if (downHeight - thisHeight < -limitHeightChange)
|
||||
limitedAlteredHeightYAxis.reset(new float(downHeight + limitHeightChange - (thisHeight - thisAlteredHeight)));
|
||||
limitedAlteredHeightYAxis = std::make_unique<float>(downHeight + limitHeightChange - (thisHeight - thisAlteredHeight));
|
||||
|
||||
// Limit altered height value based on x or y, whichever is the smallest
|
||||
compareAndLimit(cellCoords, inCellX, inCellY, limitedAlteredHeightXAxis.get(), limitedAlteredHeightYAxis.get(), &steepnessIsWithinLimits);
|
||||
|
@ -1298,8 +1298,7 @@ bool CSVRender::TerrainShapeMode::allowLandShapeEditing(const std::string& cellI
|
|||
|
||||
if (mode=="Create cell and land, then edit" && useTool)
|
||||
{
|
||||
std::unique_ptr<CSMWorld::CreateCommand> createCommand (
|
||||
new CSMWorld::CreateCommand (cellTable, cellId));
|
||||
auto createCommand = std::make_unique<CSMWorld::CreateCommand>(cellTable, cellId);
|
||||
int parentIndex = cellTable.findColumnIndex (CSMWorld::Columns::ColumnId_Cell);
|
||||
int index = cellTable.findNestedColumnIndex (parentIndex, CSMWorld::Columns::ColumnId_Interior);
|
||||
createCommand->addNestedValue (parentIndex, index, false);
|
||||
|
|
|
@ -65,11 +65,11 @@ void CSVRender::TerrainTextureMode::activate(CSVWidget::SceneToolbar* toolbar)
|
|||
|
||||
if (!mTerrainTextureSelection)
|
||||
{
|
||||
mTerrainTextureSelection.reset(new TerrainSelection(mParentNode, &getWorldspaceWidget(), TerrainSelectionType::Texture));
|
||||
mTerrainTextureSelection = std::make_shared<TerrainSelection>(mParentNode, &getWorldspaceWidget(), TerrainSelectionType::Texture);
|
||||
}
|
||||
|
||||
if (!mBrushDraw)
|
||||
mBrushDraw.reset(new BrushDraw(mParentNode, true));
|
||||
mBrushDraw = std::make_unique<BrushDraw>(mParentNode, true);
|
||||
|
||||
EditMode::activate(toolbar);
|
||||
toolbar->addTool (mTextureBrushScenetool);
|
||||
|
@ -662,8 +662,7 @@ bool CSVRender::TerrainTextureMode::allowLandTextureEditing(std::string cellId)
|
|||
|
||||
if (mode=="Create cell and land, then edit")
|
||||
{
|
||||
std::unique_ptr<CSMWorld::CreateCommand> createCommand (
|
||||
new CSMWorld::CreateCommand (cellTable, cellId));
|
||||
auto createCommand = std::make_unique<CSMWorld::CreateCommand>(cellTable, cellId);
|
||||
int parentIndex = cellTable.findColumnIndex (CSMWorld::Columns::ColumnId_Cell);
|
||||
int index = cellTable.findNestedColumnIndex (parentIndex, CSMWorld::Columns::ColumnId_Interior);
|
||||
createCommand->addNestedValue (parentIndex, index, false);
|
||||
|
|
|
@ -56,7 +56,7 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string&
|
|||
|
||||
update();
|
||||
|
||||
mCell.reset (new Cell (document.getData(), mRootNode, mCellId));
|
||||
mCell = std::make_unique<Cell>(document.getData(), mRootNode, mCellId);
|
||||
}
|
||||
|
||||
void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft,
|
||||
|
@ -105,7 +105,7 @@ bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector<CSMWorld:
|
|||
|
||||
mCellId = universalIdData.begin()->getId();
|
||||
|
||||
mCell.reset (new Cell (getDocument().getData(), mRootNode, mCellId));
|
||||
mCell = std::make_unique<Cell>(getDocument().getData(), mRootNode, mCellId);
|
||||
mCamPositionSet = false;
|
||||
mOrbitCamControl->reset();
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace CSVWorld
|
|||
Creator *CreatorFactory<CreatorT, scope>::makeCreator (CSMDoc::Document& document,
|
||||
const CSMWorld::UniversalId& id) const
|
||||
{
|
||||
std::unique_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id));
|
||||
auto creator = std::make_unique<CreatorT>(document.getData(), document.getUndoStack(), id);
|
||||
|
||||
creator->setScope (scope);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ void CSVWorld::DialogueDelegateDispatcherProxy::editorDataCommited()
|
|||
|
||||
void CSVWorld::DialogueDelegateDispatcherProxy::setIndex(const QModelIndex& index)
|
||||
{
|
||||
mIndexWrapper.reset(new refWrapper(index));
|
||||
mIndexWrapper = std::make_unique<refWrapper>(index);
|
||||
}
|
||||
|
||||
QWidget* CSVWorld::DialogueDelegateDispatcherProxy::getEditor() const
|
||||
|
|
|
@ -238,13 +238,13 @@ void CSVWorld::GenericCreator::create()
|
|||
|
||||
if (mCloneMode)
|
||||
{
|
||||
command.reset (new CSMWorld::CloneCommand (
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
|
||||
command = std::make_unique<CSMWorld::CloneCommand>(
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType);
|
||||
}
|
||||
else
|
||||
{
|
||||
command.reset (new CSMWorld::CreateCommand (
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));
|
||||
command = std::make_unique<CSMWorld::CreateCommand>(
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue