mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Disable copy constructor and assignment in basic event type and include a compatibility member function to comply with the other event types.
This commit is contained in:
parent
b8ccb1ca10
commit
0a8cf6afd2
@ -36,52 +36,12 @@ BasicEvent::BasicEvent(SQInt32 type, bool suspended) noexcept
|
|||||||
Attach();
|
Attach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
BasicEvent::BasicEvent(const BasicEvent & o) noexcept
|
|
||||||
: m_Type(o.m_Type)
|
|
||||||
, m_Stride(o.m_Stride)
|
|
||||||
, m_Ignore(o.m_Ignore)
|
|
||||||
, m_Primary(o.m_Primary)
|
|
||||||
, m_Secondary(o.m_Secondary)
|
|
||||||
, m_Idle(o.m_Idle)
|
|
||||||
, m_OnTrigger(o.m_OnTrigger)
|
|
||||||
, m_Tag(o.m_Tag)
|
|
||||||
, m_Data(o.m_Data)
|
|
||||||
, m_Suspended(o.m_Suspended)
|
|
||||||
{
|
|
||||||
Attach();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
BasicEvent::~BasicEvent()
|
BasicEvent::~BasicEvent()
|
||||||
{
|
{
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
BasicEvent & BasicEvent::operator = (const BasicEvent & o) noexcept
|
|
||||||
{
|
|
||||||
if (this != &o)
|
|
||||||
{
|
|
||||||
Detach();
|
|
||||||
|
|
||||||
m_Type = o.m_Type;
|
|
||||||
m_Stride = o.m_Stride;
|
|
||||||
m_Ignore = o.m_Ignore;
|
|
||||||
m_Primary = o.m_Primary;
|
|
||||||
m_Secondary = o.m_Secondary;
|
|
||||||
m_Idle = o.m_Idle;
|
|
||||||
m_OnTrigger = o.m_OnTrigger;
|
|
||||||
m_Tag = o.m_Tag;
|
|
||||||
m_Data = o.m_Data;
|
|
||||||
m_Suspended = o.m_Suspended;
|
|
||||||
|
|
||||||
Attach();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool BasicEvent::operator == (const BasicEvent & o) const noexcept
|
bool BasicEvent::operator == (const BasicEvent & o) const noexcept
|
||||||
{
|
{
|
||||||
@ -258,6 +218,12 @@ void BasicEvent::SetOnTrigger(const Function & func) noexcept
|
|||||||
m_OnTrigger = func;
|
m_OnTrigger = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
bool BasicEvent::Compatible(SQInt32 type) const noexcept
|
||||||
|
{
|
||||||
|
return (type != EVT_UNKNOWN && type < EVT_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void BasicEvent::BlipCreated(SQInt32 blip, SQInt32 header, Object & payload) noexcept
|
void BasicEvent::BlipCreated(SQInt32 blip, SQInt32 header, Object & payload) noexcept
|
||||||
{
|
{
|
||||||
@ -1940,8 +1906,10 @@ bool Register_BasicEvent(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
// Output debugging information
|
// Output debugging information
|
||||||
LogDbg("Beginning registration of <BasicEvent> type");
|
LogDbg("Beginning registration of <BasicEvent> type");
|
||||||
|
// Events should not be copied for the sake of simplicity
|
||||||
|
typedef NoCopy< BasicEvent > Allocator;
|
||||||
// Attempt to register the specified type
|
// Attempt to register the specified type
|
||||||
Sqrat::RootTable(vm).Bind(_SC("BasicEvent"), Sqrat::Class< BasicEvent >(vm, _SC("BasicEvent"))
|
Sqrat::RootTable(vm).Bind(_SC("BasicEvent"), Sqrat::Class< BasicEvent, Allocator >(vm, _SC("BasicEvent"))
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor<SQInt32>()
|
.Ctor<SQInt32>()
|
||||||
.Ctor<SQInt32, bool>()
|
.Ctor<SQInt32, bool>()
|
||||||
@ -1959,6 +1927,7 @@ bool Register_BasicEvent(HSQUIRRELVM vm)
|
|||||||
.Prop(_SC("primary"), &BasicEvent::GetPrimary, &BasicEvent::SetPrimary)
|
.Prop(_SC("primary"), &BasicEvent::GetPrimary, &BasicEvent::SetPrimary)
|
||||||
.Prop(_SC("secondary"), &BasicEvent::GetSecondary, &BasicEvent::SetSecondary)
|
.Prop(_SC("secondary"), &BasicEvent::GetSecondary, &BasicEvent::SetSecondary)
|
||||||
.Prop(_SC("suspended"), &BasicEvent::GetSuspended, &BasicEvent::SetSuspended)
|
.Prop(_SC("suspended"), &BasicEvent::GetSuspended, &BasicEvent::SetSuspended)
|
||||||
|
.Func(_SC("compatible"), &BasicEvent::Compatible)
|
||||||
.Func(_SC("name"), &BasicEvent::GetName)
|
.Func(_SC("name"), &BasicEvent::GetName)
|
||||||
|
|
||||||
.Prop(_SC("on_trigger"), &BasicEvent::GetOnTrigger, &BasicEvent::SetOnTrigger)
|
.Prop(_SC("on_trigger"), &BasicEvent::GetOnTrigger, &BasicEvent::SetOnTrigger)
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* ...
|
* ...
|
||||||
*/
|
*/
|
||||||
BasicEvent(const BasicEvent & o) noexcept;
|
BasicEvent(const BasicEvent &) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* ...
|
* ...
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* ...
|
* ...
|
||||||
*/
|
*/
|
||||||
BasicEvent & operator = (const BasicEvent & o) noexcept;
|
BasicEvent & operator = (const BasicEvent &) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* ...
|
* ...
|
||||||
@ -232,6 +232,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetOnTrigger(const Function & func) noexcept;
|
void SetOnTrigger(const Function & func) noexcept;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
|
bool Compatible(SQInt32 type) const noexcept;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* ...
|
* ...
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user