LUA/PERL - IsStanding() and IsCrouching() - Returns as bools

This commit is contained in:
Trust
2019-06-08 04:48:06 +00:00
parent 2690e4de4d
commit d23a6e646e
4 changed files with 70 additions and 0 deletions
+54
View File
@@ -2596,6 +2596,32 @@ XS(XS_Client_UntrainDiscAll) {
XSRETURN_EMPTY;
}
XS(XS_Client_IsStanding); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_IsStanding)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::IsStanding(THIS)");
{
Client * THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsStanding();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Client_IsSitting); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_IsSitting) {
dXSARGS;
@@ -2620,6 +2646,32 @@ XS(XS_Client_IsSitting) {
XSRETURN(1);
}
XS(XS_Client_IsCrouching); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_IsCrouching)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::IsCrouching(THIS)");
{
Client * THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsCrouching();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Client_IsBecomeNPC); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_IsBecomeNPC) {
dXSARGS;
@@ -6338,7 +6390,9 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "IsLD"), XS_Client_IsLD, file, "$");
newXSproto(strcpy(buf, "IsMedding"), XS_Client_IsMedding, file, "$");
newXSproto(strcpy(buf, "IsRaidGrouped"), XS_Client_IsRaidGrouped, file, "$");
newXSproto(strcpy(buf, "IsStanding"), XS_Client_IsStanding, file, "$");
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");
newXSproto(strcpy(buf, "IsCrouching"), XS_Client_IsCrouching, file, "$");
newXSproto(strcpy(buf, "IsTaskActive"), XS_Client_IsTaskActive, file, "$$");
newXSproto(strcpy(buf, "IsTaskActivityActive"), XS_Client_IsTaskActivityActive, file, "$$$");
newXSproto(strcpy(buf, "IsTaskCompleted"), XS_Client_IsTaskCompleted, file, "$$");