mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
perl_groups.cpp formatting
This commit is contained in:
parent
782c5ebc75
commit
cf6a9d6b2a
@ -26,7 +26,9 @@
|
||||
*/
|
||||
|
||||
#include "../common/features.h"
|
||||
|
||||
#ifdef EMBPERL_XS_CLASSES
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "embperl.h"
|
||||
|
||||
@ -42,21 +44,19 @@
|
||||
|
||||
|
||||
XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_DisbandGroup)
|
||||
{
|
||||
XS(XS_Group_DisbandGroup) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
Group *THIS;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->DisbandGroup();
|
||||
@ -65,32 +65,29 @@ XS(XS_Group_DisbandGroup)
|
||||
}
|
||||
|
||||
XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_IsGroupMember)
|
||||
{
|
||||
XS(XS_Group_IsGroupMember) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)");
|
||||
{
|
||||
Group * THIS;
|
||||
bool RETVAL;
|
||||
Mob* client;
|
||||
Group *THIS;
|
||||
bool RETVAL;
|
||||
Mob *client;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
client = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
client = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "client is not of type Mob");
|
||||
if(client == nullptr)
|
||||
if (client == nullptr)
|
||||
Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsGroupMember(client);
|
||||
@ -101,32 +98,29 @@ XS(XS_Group_IsGroupMember)
|
||||
}
|
||||
|
||||
XS(XS_Group_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_CastGroupSpell)
|
||||
{
|
||||
XS(XS_Group_CastGroupSpell) {
|
||||
dXSARGS;
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, Mob* caster, uint16 spell_id)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* caster;
|
||||
uint16 spellid = (uint16)SvUV(ST(2));
|
||||
Group *THIS;
|
||||
Mob *caster;
|
||||
uint16 spellid = (uint16) SvUV(ST(2));
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
caster = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
caster = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "caster is not of type Mob");
|
||||
if(caster == nullptr)
|
||||
if (caster == nullptr)
|
||||
Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
|
||||
|
||||
THIS->CastGroupSpell(caster, spellid);
|
||||
@ -135,32 +129,29 @@ XS(XS_Group_CastGroupSpell)
|
||||
}
|
||||
|
||||
XS(XS_Group_SplitExp); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_SplitExp)
|
||||
{
|
||||
XS(XS_Group_SplitExp) {
|
||||
dXSARGS;
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, uint32 exp, Mob* other)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint32 exp = (uint32)SvUV(ST(1));
|
||||
Mob* other;
|
||||
Group *THIS;
|
||||
uint32 exp = (uint32) SvUV(ST(1));
|
||||
Mob *other;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(2), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(2)));
|
||||
other = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(2)));
|
||||
other = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "other is not of type Mob");
|
||||
if(other == nullptr)
|
||||
if (other == nullptr)
|
||||
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SplitExp(exp, other);
|
||||
@ -169,106 +160,98 @@ XS(XS_Group_SplitExp)
|
||||
}
|
||||
|
||||
XS(XS_Group_GroupMessage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GroupMessage)
|
||||
{
|
||||
XS(XS_Group_GroupMessage) {
|
||||
dXSARGS;
|
||||
if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability
|
||||
if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability
|
||||
Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* sender;
|
||||
uint8 language;
|
||||
char* message;
|
||||
Group *THIS;
|
||||
Mob *sender;
|
||||
uint8 language;
|
||||
char *message;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
sender = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
sender = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "sender is not of type Mob");
|
||||
if(sender == nullptr)
|
||||
if (sender == nullptr)
|
||||
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
|
||||
|
||||
if (items == 4) {
|
||||
language = (uint8)SvUV(ST(2));
|
||||
language = (uint8) SvUV(ST(2));
|
||||
if ((language >= MAX_PP_LANGUAGE) || (language < 0))
|
||||
language = 0;
|
||||
message = (char *)SvPV_nolen(ST(3));
|
||||
message = (char *) SvPV_nolen(ST(3));
|
||||
THIS->GroupMessage(sender, language, 100, message);
|
||||
}
|
||||
else { // if no language is specificed, send it in common
|
||||
message = (char *)SvPV_nolen(ST(2));
|
||||
THIS->GroupMessage(sender,0, 100, message);
|
||||
} else { // if no language is specificed, send it in common
|
||||
message = (char *) SvPV_nolen(ST(2));
|
||||
THIS->GroupMessage(sender, 0, 100, message);
|
||||
}
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GetTotalGroupDamage)
|
||||
{
|
||||
XS(XS_Group_GetTotalGroupDamage) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint32 RETVAL;
|
||||
Group *THIS;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
Mob* other;
|
||||
Mob *other;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
other = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
other = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "other is not of type Mob");
|
||||
if(other == nullptr)
|
||||
if (other == nullptr)
|
||||
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetTotalGroupDamage(other);
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_SplitMoney)
|
||||
{
|
||||
XS(XS_Group_SplitMoney) {
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint32 copper = (uint32)SvUV(ST(1));
|
||||
uint32 silver = (uint32)SvUV(ST(2));
|
||||
uint32 gold = (uint32)SvUV(ST(3));
|
||||
uint32 platinum = (uint32)SvUV(ST(4));
|
||||
Group *THIS;
|
||||
uint32 copper = (uint32) SvUV(ST(1));
|
||||
uint32 silver = (uint32) SvUV(ST(2));
|
||||
uint32 gold = (uint32) SvUV(ST(3));
|
||||
uint32 platinum = (uint32) SvUV(ST(4));
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SplitMoney(copper, silver, gold, platinum);
|
||||
@ -277,31 +260,28 @@ XS(XS_Group_SplitMoney)
|
||||
}
|
||||
|
||||
XS(XS_Group_SetLeader); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_SetLeader)
|
||||
{
|
||||
XS(XS_Group_SetLeader) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* newleader;
|
||||
Group *THIS;
|
||||
Mob *newleader;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
newleader = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
newleader = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "newleader is not of type Mob");
|
||||
if(newleader == nullptr)
|
||||
if (newleader == nullptr)
|
||||
Perl_croak(aTHX_ "newleader is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SetLeader(newleader);
|
||||
@ -310,83 +290,78 @@ XS(XS_Group_SetLeader)
|
||||
}
|
||||
|
||||
XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GetLeader)
|
||||
{
|
||||
XS(XS_Group_GetLeader) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob * RETVAL;
|
||||
Group *THIS;
|
||||
Mob *RETVAL;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetLeader();
|
||||
ST(0) = sv_newmortal();
|
||||
sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
|
||||
sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GetLeaderName)
|
||||
{
|
||||
XS(XS_Group_GetLeaderName) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
const char * RETVAL;
|
||||
Group *THIS;
|
||||
const char *RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetLeaderName();
|
||||
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
|
||||
sv_setpv(TARG, RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHTARG;
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_SendHPPacketsTo)
|
||||
{
|
||||
XS(XS_Group_SendHPPacketsTo) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* newmember;
|
||||
Group *THIS;
|
||||
Mob *newmember;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
newmember = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
newmember = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "newmember is not of type Mob");
|
||||
if(newmember == nullptr)
|
||||
if (newmember == nullptr)
|
||||
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SendHPManaEndPacketsTo(newmember);
|
||||
@ -395,31 +370,28 @@ XS(XS_Group_SendHPPacketsTo)
|
||||
}
|
||||
|
||||
XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_SendHPPacketsFrom)
|
||||
{
|
||||
XS(XS_Group_SendHPPacketsFrom) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* newmember;
|
||||
Group *THIS;
|
||||
Mob *newmember;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
newmember = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
newmember = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "newmember is not of type Mob");
|
||||
if(newmember == nullptr)
|
||||
if (newmember == nullptr)
|
||||
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SendHPPacketsFrom(newmember);
|
||||
@ -428,32 +400,29 @@ XS(XS_Group_SendHPPacketsFrom)
|
||||
}
|
||||
|
||||
XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_IsLeader)
|
||||
{
|
||||
XS(XS_Group_IsLeader) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)");
|
||||
{
|
||||
Group * THIS;
|
||||
bool RETVAL;
|
||||
Mob* leadertest;
|
||||
Group *THIS;
|
||||
bool RETVAL;
|
||||
Mob *leadertest;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
leadertest = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
leadertest = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "leadertest is not of type Mob");
|
||||
if(leadertest == nullptr)
|
||||
if (leadertest == nullptr)
|
||||
Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsLeader(leadertest);
|
||||
@ -464,88 +433,84 @@ XS(XS_Group_IsLeader)
|
||||
}
|
||||
|
||||
XS(XS_Group_GroupCount); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GroupCount)
|
||||
{
|
||||
XS(XS_Group_GroupCount) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint8 RETVAL;
|
||||
Group *THIS;
|
||||
uint8 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GroupCount();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GetHighestLevel)
|
||||
{
|
||||
XS(XS_Group_GetHighestLevel) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint32 RETVAL;
|
||||
Group *THIS;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetHighestLevel();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_TeleportGroup)
|
||||
{
|
||||
XS(XS_Group_TeleportGroup) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_ "Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* sender;
|
||||
uint32 zoneID = (uint32)SvUV(ST(2));
|
||||
float x = (float)SvNV(ST(3));
|
||||
float y = (float)SvNV(ST(4));
|
||||
float z = (float)SvNV(ST(5));
|
||||
float heading = (float)SvNV(ST(6));
|
||||
Group *THIS;
|
||||
Mob *sender;
|
||||
uint32 zoneID = (uint32) SvUV(ST(2));
|
||||
float x = (float) SvNV(ST(3));
|
||||
float y = (float) SvNV(ST(4));
|
||||
float z = (float) SvNV(ST(5));
|
||||
float heading = (float) SvNV(ST(6));
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
sender = INT2PTR(Mob *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
sender = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "sender is not of type Mob");
|
||||
if(sender == nullptr)
|
||||
if (sender == nullptr)
|
||||
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
|
||||
|
||||
THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading);
|
||||
@ -554,63 +519,60 @@ XS(XS_Group_TeleportGroup)
|
||||
}
|
||||
|
||||
XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_GetID)
|
||||
{
|
||||
XS(XS_Group_GetID) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetID(THIS)");
|
||||
{
|
||||
Group * THIS;
|
||||
uint32 RETVAL;
|
||||
Group *THIS;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetID();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Group_GetMember);
|
||||
XS(XS_Group_GetMember)
|
||||
{
|
||||
XS(XS_Group_GetMember) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)");
|
||||
{
|
||||
Group * THIS;
|
||||
Mob* member;
|
||||
Client* RETVAL = nullptr;
|
||||
Group *THIS;
|
||||
Mob *member;
|
||||
Client *RETVAL = nullptr;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Group")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Group *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Group");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
int index = (int)SvUV(ST(1));
|
||||
int index = (int) SvUV(ST(1));
|
||||
if (index < 0 || index > 5)
|
||||
RETVAL = nullptr;
|
||||
else {
|
||||
member = THIS->members[index];
|
||||
member = THIS->members[index];
|
||||
if (member != nullptr)
|
||||
RETVAL = member->CastToClient();
|
||||
}
|
||||
|
||||
ST(0) = sv_newmortal();
|
||||
sv_setref_pv(ST(0), "Client", (void*)RETVAL);
|
||||
ST(0) = sv_newmortal();
|
||||
sv_setref_pv(ST(0), "Client", (void *) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
@ -619,39 +581,38 @@ XS(XS_Group_GetMember)
|
||||
extern "C"
|
||||
#endif
|
||||
XS(boot_Group); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(boot_Group)
|
||||
{
|
||||
XS(boot_Group) {
|
||||
dXSARGS;
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
if(items != 1)
|
||||
if (items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
//add the strcpy stuff to get rid of const warnings....
|
||||
|
||||
XS_VERSION_BOOTCHECK ;
|
||||
XS_VERSION_BOOTCHECK;
|
||||
|
||||
newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
|
||||
newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");
|
||||
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$");
|
||||
newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$");
|
||||
newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$");
|
||||
newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$");
|
||||
newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$");
|
||||
newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$");
|
||||
newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$");
|
||||
newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$");
|
||||
newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$");
|
||||
newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$");
|
||||
newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$");
|
||||
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$");
|
||||
newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$");
|
||||
newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$");
|
||||
newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$");
|
||||
newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
|
||||
newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");
|
||||
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$");
|
||||
newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$");
|
||||
newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$");
|
||||
newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$");
|
||||
newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$");
|
||||
newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$");
|
||||
newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$");
|
||||
newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$");
|
||||
newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$");
|
||||
newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$");
|
||||
newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$");
|
||||
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$");
|
||||
newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$");
|
||||
newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$");
|
||||
newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user