diff --git a/source/Core.cpp b/source/Core.cpp index e25522ca..98d5824c 100644 --- a/source/Core.cpp +++ b/source/Core.cpp @@ -525,6 +525,28 @@ void Core::CompilerErrorHandler(HSQUIRRELVM /*vm*/, CSStr desc, CSStr src, SQInt LogFtl("Message: %s\n[\n=>Location: %s\n=>Line: %d\n=>Column: %d\n]", desc, src, line, column); } +// ------------------------------------------------------------------------------------------------ +void Core::BindEvent(Int32 id, Object & env, Function & func) +{ + // Obtain the function instance called for this event + Function & event = GetEvent(id); + // Is the specified callback function null? + if (func.IsNull()) + { + event.Release(); // Then release the current callback + } + // Does this function need a custom environment? + else if (env.IsNull()) + { + event = func; + } + // Assign the specified environment and function + else + { + event = Function(env.GetVM(), env, func.GetFunc()); + } +} + // ------------------------------------------------------------------------------------------------ Core::BlipInst::~BlipInst() { diff --git a/source/CoreEntity.cpp b/source/CoreEntity.cpp index 8624716a..41aa92a5 100644 --- a/source/CoreEntity.cpp +++ b/source/CoreEntity.cpp @@ -860,23 +860,6 @@ bool Core::DelVehicle(Int32 id, Int32 header, Object & payload) return true; } -// ------------------------------------------------------------------------------------------------ -void Core::BindEvent(Int32 id, Object & env, Function & func) -{ - // Obtain the function instance called for this event - Function & event = GetEvent(id); - // Is the specified callback function null? - if (func.IsNull()) - { - event.Release(); // Then release the current callback - } - // Assign the specified environment and function - else - { - event = Function(env.GetVM(), env, func.GetFunc()); - } -} - // -------------------------------------------------------------------------------------------- void Core::ConnectPlayer(Int32 id, Int32 header, Object & payload) {