Use cell coordinates class, fix undo description.

This commit is contained in:
Aesylwinn 2016-05-21 14:36:07 -04:00
parent b86250036c
commit 799ed300ea
2 changed files with 6 additions and 11 deletions

View file

@ -8,6 +8,7 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QAbstractProxyModel> #include <QAbstractProxyModel>
#include "cellcoordinates.hpp"
#include "idcollection.hpp" #include "idcollection.hpp"
#include "idtable.hpp" #include "idtable.hpp"
#include "idtree.hpp" #include "idtree.hpp"
@ -251,17 +252,11 @@ void CSMWorld::CreatePathgridCommand::redo()
record.get().blank(); record.get().blank();
record.get().mCell = mId; record.get().mCell = mId;
if (!mId.empty() && mId[0]=='#') std::pair<CellCoordinates, bool> coords = CellCoordinates::fromId(mId);
if (coords.second)
{ {
int x, y; record.get().mData.mX = coords.first.getX();
char ignore; record.get().mData.mY = coords.first.getY();
std::istringstream stream (mId);
if (stream >> ignore >> x >> y)
{
record.get().mData.mX = x;
record.get().mData.mY = y;
}
} }
mModel.setRecord(mId, record, mType); mModel.setRecord(mId, record, mType);

View file

@ -60,7 +60,7 @@ namespace CSVRender
{ {
// Add node // Add node
QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack(); QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack();
QString description = "Connect node to selected nodes"; QString description = "Add node";
CSMWorld::CommandMacro macro(undoStack, description); CSMWorld::CommandMacro macro(undoStack, description);
cell->getPathgrid()->applyPoint(macro, hitResult.worldPos); cell->getPathgrid()->applyPoint(macro, hitResult.worldPos);