1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Added StartScriptCreator class with redefined getErrors method.

This commit is contained in:
artemutin@yandex.ru 2015-09-29 10:46:03 +10:00
parent 435e52306a
commit 3f27c85630
2 changed files with 51 additions and 0 deletions

View file

@ -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;
}

View file

@ -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