Fix potential segfault, cleanup, get rid of warnings.

new-script-api
Kyle Cooley 7 years ago
parent 72cb405de2
commit d030b595f8

@ -297,7 +297,6 @@ namespace CSMWorld
{
int index = cloneRecordImp(origin, destination, type);
mRecords.at(index).get().mPlugin = 0;
mRecords.at(index).get().mContext.filename.clear();
}
template<typename ESXRecordT, typename IdAccessorT>
@ -313,7 +312,6 @@ namespace CSMWorld
if (index >= 0)
{
mRecords.at(index).get().mPlugin = 0;
mRecords.at(index).get().mContext.filename.clear();
return true;
}

@ -75,7 +75,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
return modified;
}
void CSVRender::Cell::createLand()
void CSVRender::Cell::updateLand()
{
// Cell is deleted
if (mDeleted)
@ -152,7 +152,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
addObjects (0, rows-1);
createLand();
updateLand();
mPathgrid.reset(new Pathgrid(mData, mCellNode, mId, mCoordinates));
mCellWater.reset(new CellWater(mData, mCellNode, mId, mCoordinates));
@ -325,32 +325,32 @@ void CSVRender::Cell::pathgridRemoved()
void CSVRender::Cell::landDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
createLand();
updateLand();
}
void CSVRender::Cell::landAboutToBeRemoved (const QModelIndex& parent, int start, int end)
{
createLand();
updateLand();
}
void CSVRender::Cell::landAdded (const QModelIndex& parent, int start, int end)
{
createLand();
updateLand();
}
void CSVRender::Cell::landTextureChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
createLand();
updateLand();
}
void CSVRender::Cell::landTextureAboutToBeRemoved (const QModelIndex& parent, int start, int end)
{
createLand();
updateLand();
}
void CSVRender::Cell::landTextureAdded (const QModelIndex& parent, int start, int end)
{
createLand();
updateLand();
}
void CSVRender::Cell::reloadAssets()

@ -72,7 +72,7 @@ namespace CSVRender
/// \return Have any objects been added?
bool addObjects (int start, int end);
void createLand();
void updateLand();
void unloadLand();
public:

@ -262,18 +262,17 @@ void CSVWorld::GenericCreator::cloneMode(const std::string& originId,
void CSVWorld::GenericCreator::touch(const std::vector<CSMWorld::UniversalId>& ids)
{
// Combine multiple touch commands into one "macro" command
std::unique_ptr<QUndoCommand> macro(new QUndoCommand());
macro->setText("Touch records");
mUndoStack.beginMacro("Touch Records");
CSMWorld::IdTable& table = dynamic_cast<CSMWorld::IdTable&>(*mData.getTableModel(mListId));
for (const CSMWorld::UniversalId& uid : ids)
{
// This is not leaked, touchCmd is a child of macro and managed by Qt
CSMWorld::TouchCommand* touchCmd = new CSMWorld::TouchCommand(table, uid.getId(), macro.get());
CSMWorld::TouchCommand* touchCmd = new CSMWorld::TouchCommand(table, uid.getId());
mUndoStack.push(touchCmd);
}
// Execute
mUndoStack.push(macro.release());
mUndoStack.endMacro();
}
void CSVWorld::GenericCreator::toggleWidgets(bool active)

@ -55,19 +55,18 @@ namespace CSVWorld
void LandCreator::touch(const std::vector<CSMWorld::UniversalId>& ids)
{
// Combine multiple touch commands into one "macro" command
std::unique_ptr<QUndoCommand> macro(new QUndoCommand());
macro->setText("Touch records");
getUndoStack().beginMacro("Touch records");
CSMWorld::IdTable& lands = dynamic_cast<CSMWorld::IdTable&>(*getData().getTableModel(CSMWorld::UniversalId::Type_Lands));
CSMWorld::IdTable& ltexs = dynamic_cast<CSMWorld::IdTable&>(*getData().getTableModel(CSMWorld::UniversalId::Type_LandTextures));
for (const CSMWorld::UniversalId& uid : ids)
{
// This is not leaked, touchCmd is a child of macro and managed by Qt
CSMWorld::TouchLandCommand* touchCmd = new CSMWorld::TouchLandCommand(lands, ltexs, uid.getId(), macro.get());
CSMWorld::TouchLandCommand* touchCmd = new CSMWorld::TouchLandCommand(lands, ltexs, uid.getId());
getUndoStack().push(touchCmd);
}
// Execute
getUndoStack().push(macro.release());
getUndoStack().endMacro();
}
void LandCreator::focus()

@ -238,7 +238,11 @@ namespace ESM
// Copy data to target if no file
if (mContext.filename.empty())
{
*target = *mLandData;
if (mLandData)
*target = *mLandData;
else
target = new LandData;
return;
}

Loading…
Cancel
Save