1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-18 19:47:15 +01:00

Updated the basic event type to used the new debugging system.

This commit is contained in:
Sandu Liviu Catalin 2015-11-11 12:14:21 +02:00
parent d6b964d82c
commit 8061c485fc
2 changed files with 14 additions and 11 deletions

View File

@ -34,7 +34,7 @@ BasicEvent::BasicEvent(SQInt32 type, bool suspended)
, m_Suspended(suspended) , m_Suspended(suspended)
{ {
// Attach to the specified event signal // Attach to the specified event signal
Attach(); Attach("constructor");
// Receive notification when the VM is about to be closed to release object references // Receive notification when the VM is about to be closed to release object references
_Core->VMClose.Connect< BasicEvent, &BasicEvent::VMClose >(this); _Core->VMClose.Connect< BasicEvent, &BasicEvent::VMClose >(this);
} }
@ -43,7 +43,7 @@ BasicEvent::BasicEvent(SQInt32 type, bool suspended)
BasicEvent::~BasicEvent() BasicEvent::~BasicEvent()
{ {
// Detach from the specified event signal // Detach from the specified event signal
Detach(); Detach("destructor");
// Stop receiving notification when the VM is about to be closed // Stop receiving notification when the VM is about to be closed
_Core->VMClose.Disconnect< BasicEvent, &BasicEvent::VMClose >(this); _Core->VMClose.Disconnect< BasicEvent, &BasicEvent::VMClose >(this);
} }
@ -149,16 +149,17 @@ void BasicEvent::SetType(SQInt32 type)
// Make sure the newly specified event is valid // Make sure the newly specified event is valid
if (type == EVT_UNKNOWN || type >= EVT_COUNT) if (type == EVT_UNKNOWN || type >= EVT_COUNT)
{ {
LogErr("Cannot change the event to an incompatible type: %s", GetEventName(type)); DbgErr("BasicEvent", "@type", "Cannot change the event to an incompatible type: %s",
GetEventName(type));
} }
else else
{ {
// Detach from the current event type // Detach from the current event type
Detach(); Detach("@type");
// Set the new event type // Set the new event type
m_Type = type; m_Type = type;
// Attach to the new event type // Attach to the new event type
Attach(); Attach("@type");
} }
} }
@ -1289,7 +1290,7 @@ bool BasicEvent::Trigger()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BasicEvent::Attach() void BasicEvent::Attach(const char * func)
{ {
switch (m_Type) switch (m_Type)
{ {
@ -1603,12 +1604,13 @@ void BasicEvent::Attach()
_Core->ScriptReload.Connect< BasicEvent, &BasicEvent::ScriptReload >(this); _Core->ScriptReload.Connect< BasicEvent, &BasicEvent::ScriptReload >(this);
break; break;
default: default:
LogErr("Attempting to <attach> to an unknown event type: %d", _SCI32(m_Type)); DbgErr("BasicEvent", func, "Attempting to <attach event> to an unknown type: %d",
_SCI32(m_Type));
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BasicEvent::Detach() void BasicEvent::Detach(const char * func)
{ {
switch (m_Type) switch (m_Type)
{ {
@ -1922,7 +1924,8 @@ void BasicEvent::Detach()
_Core->ScriptReload.Disconnect< BasicEvent, &BasicEvent::ScriptReload >(this); _Core->ScriptReload.Disconnect< BasicEvent, &BasicEvent::ScriptReload >(this);
break; break;
default: default:
LogErr("Attempting to <dettach> to an unknown event type: %d", _SCI32(m_Type)); DbgErr("BasicEvent", func, "Attempting to <dettach event> from an unknown type: %d",
_SCI32(m_Type));
} }
} }

View File

@ -777,12 +777,12 @@ protected:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* ... * ...
*/ */
void Attach(); void Attach(const char * func);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* ... * ...
*/ */
void Detach(); void Detach(const char * func);
private: private: