1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-30 22:17:13 +02:00

Implement association of arbitrary user data in command listeners.

Also keep track of all listener instances by having them link to eachother as a double linked list. This should make it easy to release any script resources at shutdown.
Now that all listeners are being tracked, binding callbacks is less strict and does not require a listener to be attached anymore.
This commit is contained in:
Sandu Liviu Catalin
2016-10-29 22:08:38 +03:00
parent 0111cc5a46
commit 4ad9402d8a
2 changed files with 87 additions and 24 deletions

View File

@ -8,6 +8,9 @@ namespace Cmd {
// ------------------------------------------------------------------------------------------------
Controllers Controller::s_Controllers;
// ------------------------------------------------------------------------------------------------
Listener * Listener::s_Head = nullptr;
// ------------------------------------------------------------------------------------------------
SQInteger Manager::Typename(HSQUIRRELVM vm)
{
@ -1090,6 +1093,7 @@ void Register(HSQUIRRELVM vm)
.Prop(_SC("Attached"), &Listener::Attached)
.Prop(_SC("Manager"), &Listener::GetManager)
.Prop(_SC("Name"), &Listener::GetName, &Listener::SetName)
.Prop(_SC("Data"), &Listener::GetData, &Listener::SetData)
.Prop(_SC("Spec"), &Listener::GetSpec, &Listener::SetSpec)
.Prop(_SC("Specifier"), &Listener::GetSpec, &Listener::SetSpec)
.Prop(_SC("Tags"), &Listener::GetArgTags, &Listener::SetArgTags)
@ -1168,6 +1172,7 @@ void Register_Command(HSQUIRRELVM vm)
void TerminateCommands()
{
Cmd::Controller::Terminate();
Cmd::Listener::Terminate();
}
} // Namespace:: SqMod