1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 13:15:32 +00:00

added a function to determine if a script contains OnActivate

This commit is contained in:
rexelion 2017-10-28 20:56:08 +01:00
parent ae14aa0c84
commit 1ee5dcff77
3 changed files with 14 additions and 0 deletions

View file

@ -42,6 +42,10 @@ namespace MWBase
///< Compile script with the given namen ///< Compile script with the given namen
/// \return Success? /// \return Success?
virtual bool hasOnActivate (const std::string& name) = 0;
///< Determine if a script with the given name contains OnActivate
/// \return Contains OnActivate?
virtual std::pair<int, int> compileAll() = 0; virtual std::pair<int, int> compileAll() = 0;
///< Compile all scripts ///< Compile all scripts
/// \return count, success /// \return count, success

View file

@ -88,6 +88,12 @@ namespace MWScript
return false; return false;
} }
bool ScriptManager::hasOnActivate(const std::string& name)
{
const ESM::Script *script = mStore.get<ESM::Script>().find(name);
return script->mScriptText.find("OnActivate");
}
void ScriptManager::run (const std::string& name, Interpreter::Context& interpreterContext) void ScriptManager::run (const std::string& name, Interpreter::Context& interpreterContext)
{ {
// compile script // compile script

View file

@ -62,6 +62,10 @@ namespace MWScript
///< Compile script with the given namen ///< Compile script with the given namen
/// \return Success? /// \return Success?
virtual bool hasOnActivate(const std::string& name);
///< Determine if a script with the given name contains OnActivate
/// \return Contains OnActivate?
virtual std::pair<int, int> compileAll(); virtual std::pair<int, int> compileAll();
///< Compile all scripts ///< Compile all scripts
/// \return count, success /// \return count, success