perl_groups.cpp formatting

This commit is contained in:
Akkadius 2018-07-01 20:01:03 -05:00
parent 782c5ebc75
commit cf6a9d6b2a

View File

@ -26,7 +26,9 @@
*/ */
#include "../common/features.h" #include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@ -42,21 +44,19 @@
XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_DisbandGroup) XS(XS_Group_DisbandGroup) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)"); Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)");
{ {
Group * THIS; Group *THIS;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->DisbandGroup(); THIS->DisbandGroup();
@ -65,32 +65,29 @@ XS(XS_Group_DisbandGroup)
} }
XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsGroupMember) XS(XS_Group_IsGroupMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)"); Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)");
{ {
Group * THIS; Group *THIS;
bool RETVAL; bool RETVAL;
Mob* client; Mob *client;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
client = INT2PTR(Mob *,tmp); client = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "client is not of type Mob"); Perl_croak(aTHX_ "client is not of type Mob");
if(client == nullptr) if (client == nullptr)
Perl_croak(aTHX_ "client is nullptr, avoiding crash."); Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupMember(client); 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); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_CastGroupSpell) XS(XS_Group_CastGroupSpell) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, Mob* caster, uint16 spell_id)"); Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, Mob* caster, uint16 spell_id)");
{ {
Group * THIS; Group *THIS;
Mob* caster; Mob *caster;
uint16 spellid = (uint16)SvUV(ST(2)); uint16 spellid = (uint16) SvUV(ST(2));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *,tmp); caster = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "caster is not of type Mob"); Perl_croak(aTHX_ "caster is not of type Mob");
if(caster == nullptr) if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
THIS->CastGroupSpell(caster, spellid); 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); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SplitExp) XS(XS_Group_SplitExp) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, uint32 exp, Mob* other)"); Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, uint32 exp, Mob* other)");
{ {
Group * THIS; Group *THIS;
uint32 exp = (uint32)SvUV(ST(1)); uint32 exp = (uint32) SvUV(ST(1));
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(2), "Mob")) { if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(2))); IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
THIS->SplitExp(exp, other); 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); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GroupMessage) XS(XS_Group_GroupMessage) {
{
dXSARGS; 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)"); Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)");
{ {
Group * THIS; Group *THIS;
Mob* sender; Mob *sender;
uint8 language; uint8 language;
char* message; char *message;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
if (items == 4) { if (items == 4) {
language = (uint8)SvUV(ST(2)); language = (uint8) SvUV(ST(2));
if ((language >= MAX_PP_LANGUAGE) || (language < 0)) if ((language >= MAX_PP_LANGUAGE) || (language < 0))
language = 0; language = 0;
message = (char *)SvPV_nolen(ST(3)); message = (char *) SvPV_nolen(ST(3));
THIS->GroupMessage(sender, language, 100, message); THIS->GroupMessage(sender, language, 100, message);
} } else { // if no language is specificed, send it in common
else { // if no language is specificed, send it in common message = (char *) SvPV_nolen(ST(2));
message = (char *)SvPV_nolen(ST(2)); THIS->GroupMessage(sender, 0, 100, message);
THIS->GroupMessage(sender,0, 100, message);
} }
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetTotalGroupDamage) XS(XS_Group_GetTotalGroupDamage) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)"); Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
RETVAL = THIS->GetTotalGroupDamage(other); RETVAL = THIS->GetTotalGroupDamage(other);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SplitMoney) XS(XS_Group_SplitMoney) {
{
dXSARGS; dXSARGS;
if (items != 5) if (items != 5)
Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)"); Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
{ {
Group * THIS; Group *THIS;
uint32 copper = (uint32)SvUV(ST(1)); uint32 copper = (uint32) SvUV(ST(1));
uint32 silver = (uint32)SvUV(ST(2)); uint32 silver = (uint32) SvUV(ST(2));
uint32 gold = (uint32)SvUV(ST(3)); uint32 gold = (uint32) SvUV(ST(3));
uint32 platinum = (uint32)SvUV(ST(4)); uint32 platinum = (uint32) SvUV(ST(4));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SplitMoney(copper, silver, gold, platinum); 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); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SetLeader) XS(XS_Group_SetLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)"); Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)");
{ {
Group * THIS; Group *THIS;
Mob* newleader; Mob *newleader;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newleader = INT2PTR(Mob *,tmp); newleader = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newleader is not of type Mob"); Perl_croak(aTHX_ "newleader is not of type Mob");
if(newleader == nullptr) if (newleader == nullptr)
Perl_croak(aTHX_ "newleader is nullptr, avoiding crash."); Perl_croak(aTHX_ "newleader is nullptr, avoiding crash.");
THIS->SetLeader(newleader); THIS->SetLeader(newleader);
@ -310,83 +290,78 @@ XS(XS_Group_SetLeader)
} }
XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeader) XS(XS_Group_GetLeader) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)");
{ {
Group * THIS; Group *THIS;
Mob * RETVAL; Mob *RETVAL;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeader(); RETVAL = THIS->GetLeader();
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Mob", (void*)RETVAL); sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeaderName) XS(XS_Group_GetLeaderName) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)");
{ {
Group * THIS; Group *THIS;
const char * RETVAL; const char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeaderName(); RETVAL = THIS->GetLeaderName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsTo) XS(XS_Group_SendHPPacketsTo) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)"); Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)");
{ {
Group * THIS; Group *THIS;
Mob* newmember; Mob *newmember;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp); newmember = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newmember is not of type Mob"); Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr) if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPManaEndPacketsTo(newmember); THIS->SendHPManaEndPacketsTo(newmember);
@ -395,31 +370,28 @@ XS(XS_Group_SendHPPacketsTo)
} }
XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsFrom) XS(XS_Group_SendHPPacketsFrom) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)"); Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)");
{ {
Group * THIS; Group *THIS;
Mob* newmember; Mob *newmember;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp); newmember = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newmember is not of type Mob"); Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr) if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPPacketsFrom(newmember); THIS->SendHPPacketsFrom(newmember);
@ -428,32 +400,29 @@ XS(XS_Group_SendHPPacketsFrom)
} }
XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsLeader) XS(XS_Group_IsLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)"); Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)");
{ {
Group * THIS; Group *THIS;
bool RETVAL; bool RETVAL;
Mob* leadertest; Mob *leadertest;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
leadertest = INT2PTR(Mob *,tmp); leadertest = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "leadertest is not of type Mob"); Perl_croak(aTHX_ "leadertest is not of type Mob");
if(leadertest == nullptr) if (leadertest == nullptr)
Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash."); Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(leadertest); 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); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GroupCount) XS(XS_Group_GroupCount) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)"); Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)");
{ {
Group * THIS; Group *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount(); RETVAL = THIS->GroupCount();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetHighestLevel) XS(XS_Group_GetHighestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetHighestLevel(); RETVAL = THIS->GetHighestLevel();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_TeleportGroup) XS(XS_Group_TeleportGroup) {
{
dXSARGS; dXSARGS;
if (items != 7) 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; Group *THIS;
Mob* sender; Mob *sender;
uint32 zoneID = (uint32)SvUV(ST(2)); uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float)SvNV(ST(3)); float x = (float) SvNV(ST(3));
float y = (float)SvNV(ST(4)); float y = (float) SvNV(ST(4));
float z = (float)SvNV(ST(5)); float z = (float) SvNV(ST(5));
float heading = (float)SvNV(ST(6)); float heading = (float) SvNV(ST(6));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading); THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading);
@ -554,53 +519,50 @@ XS(XS_Group_TeleportGroup)
} }
XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetID) XS(XS_Group_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetID(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetID(THIS)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetID(); RETVAL = THIS->GetID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetMember); XS(XS_Group_GetMember);
XS(XS_Group_GetMember) XS(XS_Group_GetMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)"); Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)");
{ {
Group * THIS; Group *THIS;
Mob* member; Mob *member;
Client* RETVAL = nullptr; Client *RETVAL = nullptr;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); 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) if (index < 0 || index > 5)
RETVAL = nullptr; RETVAL = nullptr;
else { else {
@ -610,7 +572,7 @@ XS(XS_Group_GetMember)
} }
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL); sv_setref_pv(ST(0), "Client", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@ -619,20 +581,19 @@ XS(XS_Group_GetMember)
extern "C" extern "C"
#endif #endif
XS(boot_Group); /* prototype to pass -Wmissing-prototypes */ XS(boot_Group); /* prototype to pass -Wmissing-prototypes */
XS(boot_Group) XS(boot_Group) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //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, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$"); newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");