Added StartScriptCreator class with redefined getErrors method.
parent
435e52306a
commit
3f27c85630
@ -0,0 +1,26 @@
|
||||
#include "startscriptcreator.hpp"
|
||||
|
||||
StartScriptCreator::StartScriptCreator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
CSVWORLD::StartScriptCreator::StartScriptCreator(CSMWorld::Data &data, QUndoStack &undoStack, const CSMWorld::UniversalId &id, bool relaxedIdRules):
|
||||
GenericCreator (data, undoStack, id, true)
|
||||
{}
|
||||
|
||||
std::string CSVWORLD::StartScriptCreator::getErrors() const
|
||||
{
|
||||
std::string errors;
|
||||
|
||||
errors = getIdValidatorResult();
|
||||
if (errors.length() > 0)
|
||||
return errors;
|
||||
else if (getData().getScripts().searchId(getId()) == -1)
|
||||
errors = "Script ID not found";
|
||||
else if (getData().getStartScripts().searchId(getId()) > -1 )
|
||||
errors = "Script with this ID already registered as Start Script";
|
||||
|
||||
return errors;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#ifndef STARTSCRIPTCREATOR_HPP
|
||||
#define STARTSCRIPTCREATOR_HPP
|
||||
|
||||
#include "genericcreator.hpp"
|
||||
|
||||
namespace CSVWORLD {
|
||||
|
||||
class StartScriptCreator : public GenericCreator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StartScriptCreator(CSMWorld::Data& data, QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id, bool relaxedIdRules = false);
|
||||
|
||||
virtual std::string getErrors() const;
|
||||
///< Return formatted error descriptions for the current state of the creator. if an empty
|
||||
/// string is returned, there is no error.
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // STARTSCRIPTCREATOR_HPP
|
Loading…
Reference in New Issue