1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +01:00

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

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

View File

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

View File

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