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

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

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 14:49:12 +02:00
parent 6373c24bae
commit cb8b595318
2 changed files with 23 additions and 3 deletions

View File

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

View File

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