Editor: Add PathgridCreator to find duplicate IDs
parent
c9ada852aa
commit
b129ff9672
@ -0,0 +1,29 @@
|
||||
#include "pathgridcreator.hpp"
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
|
||||
CSVWorld::PathgridCreator::PathgridCreator(
|
||||
CSMWorld::Data& data,
|
||||
QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id,
|
||||
bool relaxedIdRules
|
||||
) : GenericCreator(data, undoStack, id, relaxedIdRules)
|
||||
{}
|
||||
|
||||
std::string CSVWorld::PathgridCreator::getErrors() const
|
||||
{
|
||||
std::string pathgridId = getId();
|
||||
|
||||
// Check user input for any errors.
|
||||
std::string errors;
|
||||
if (pathgridId.empty())
|
||||
{
|
||||
errors = "No Pathgrid ID entered";
|
||||
}
|
||||
else if (getData().getPathgrids().searchId(pathgridId) > -1)
|
||||
{
|
||||
errors = "Pathgrid with this ID already exists";
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
#ifndef PATHGRIDCREATOR_HPP
|
||||
#define PATHGRIDCREATOR_HPP
|
||||
|
||||
#include "genericcreator.hpp"
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
/// \brief Record creator for pathgrids.
|
||||
class PathgridCreator : public GenericCreator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
PathgridCreator(
|
||||
CSMWorld::Data& data,
|
||||
QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id,
|
||||
bool relaxedIdRules = false);
|
||||
|
||||
/// \return Error description for current user input.
|
||||
virtual std::string getErrors() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PATHGRIDCREATOR_HPP
|
Loading…
Reference in New Issue