1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Adjust the Keybind entity methods to use the new method of receiving formatted strings.

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 14:48:28 +02:00
parent 5669802169
commit e1fd4e1ee2
2 changed files with 23 additions and 3 deletions

View File

@ -51,9 +51,23 @@ const String & CKeybind::GetTag() const
}
// ------------------------------------------------------------------------------------------------
void CKeybind::SetTag(CSStr tag)
void CKeybind::SetTag(const StackStrF & tag)
{
m_Tag.assign(tag);
if (tag.mLen > 0)
{
m_Tag.assign(tag.mPtr, tag.mLen);
}
else
{
m_Tag.clear();
}
}
// ------------------------------------------------------------------------------------------------
CKeybind & CKeybind::ApplyTag(StackStrF & tag)
{
SetTag(tag);
return *this;
}
// ------------------------------------------------------------------------------------------------
@ -202,6 +216,7 @@ void Register_CKeybind(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CKeybind::IsActive)
// Core Methods
.Func(_SC("Bind"), &CKeybind::BindEvent)
.FmtFunc(_SC("SetTag"), &CKeybind::ApplyTag)
.Func(_SC("CustomEvent"), &CKeybind::CustomEvent)
// Core Overloads
.Overload< bool (CKeybind::*)(void) >(_SC("Destroy"), &CKeybind::Destroy)

View File

@ -119,7 +119,12 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
void SetTag(CSStr tag);
void SetTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CKeybind & ApplyTag(StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.