perl_raids.cpp formatting

This commit is contained in:
Akkadius 2018-07-01 20:39:21 -05:00
parent 57c1cd0be4
commit 94aa271a84

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"
@ -43,23 +45,21 @@
XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsRaidMember) XS(XS_Raid_IsRaidMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)"); Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRaidMember(name); RETVAL = THIS->IsRaidMember(name);
@ -70,33 +70,30 @@ XS(XS_Raid_IsRaidMember)
} }
XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_CastGroupSpell) XS(XS_Raid_CastGroupSpell) {
{
dXSARGS; dXSARGS;
if (items != 4) if (items != 4)
Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, Mob* caster, uint16 spell_id, uint32 group_id)"); Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, Mob* caster, uint16 spell_id, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
Mob* caster; Mob *caster;
uint16 spellid = (uint16)SvUV(ST(2)); uint16 spellid = (uint16) SvUV(ST(2));
uint32 gid = (uint32)SvUV(ST(3)); uint32 gid = (uint32) SvUV(ST(3));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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, gid); THIS->CastGroupSpell(caster, spellid, gid);
@ -105,112 +102,106 @@ XS(XS_Raid_CastGroupSpell)
} }
XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GroupCount) XS(XS_Raid_GroupCount) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)"); Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
uint32 gid = (uint32)SvUV(ST(1)); uint32 gid = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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(gid); RETVAL = THIS->GroupCount(gid);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_RaidCount) XS(XS_Raid_RaidCount) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)"); Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->RaidCount(); RETVAL = THIS->RaidCount();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetGroup) XS(XS_Raid_GetGroup) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)"); Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetGroup(name); RETVAL = THIS->GetGroup(name);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitExp) XS(XS_Raid_SplitExp) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, uint32 experience, [Mob* other = nullptr])"); Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, uint32 experience, [Mob* other = nullptr])");
{ {
Raid * THIS; Raid *THIS;
uint32 exp = (uint32)SvUV(ST(1)); uint32 exp = (uint32) SvUV(ST(1));
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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);
@ -219,61 +210,57 @@ XS(XS_Raid_SplitExp)
} }
XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetTotalRaidDamage) XS(XS_Raid_GetTotalRaidDamage) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])"); Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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->GetTotalRaidDamage(other); RETVAL = THIS->GetTotalRaidDamage(other);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitMoney) XS(XS_Raid_SplitMoney) {
{
dXSARGS; dXSARGS;
if (items != 5) if (items != 5)
Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)"); Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
{ {
Raid * THIS; Raid *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), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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);
@ -282,23 +269,21 @@ XS(XS_Raid_SplitMoney)
} }
XS(XS_Raid_BalanceHP); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_BalanceHP); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_BalanceHP) XS(XS_Raid_BalanceHP) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, int32 penalty, uint32 group_id)"); Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, int32 penalty, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
int32 penalty = (int32)SvUV(ST(1)); int32 penalty = (int32) SvUV(ST(1));
uint32 gid = (uint32)SvUV(ST(2)); uint32 gid = (uint32) SvUV(ST(2));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->BalanceHP(penalty, gid); THIS->BalanceHP(penalty, gid);
@ -307,23 +292,21 @@ XS(XS_Raid_BalanceHP)
} }
XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsLeader) XS(XS_Raid_IsLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)"); Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(name); RETVAL = THIS->IsLeader(name);
@ -334,23 +317,21 @@ XS(XS_Raid_IsLeader)
} }
XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsGroupLeader) XS(XS_Raid_IsGroupLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)"); Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* who = (char *)SvPV_nolen(ST(1)); const char *who = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupLeader(who); RETVAL = THIS->IsGroupLeader(who);
@ -361,116 +342,110 @@ XS(XS_Raid_IsGroupLeader)
} }
XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetHighestLevel) XS(XS_Raid_GetHighestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetLowestLevel) XS(XS_Raid_GetLowestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLowestLevel(); RETVAL = THIS->GetLowestLevel();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetClientByIndex) XS(XS_Raid_GetClientByIndex) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_indez)"); Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_indez)");
{ {
Raid * THIS; Raid *THIS;
Client * RETVAL; Client *RETVAL;
uint16 index = (uint16)SvUV(ST(1)); uint16 index = (uint16) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetClientByIndex(index); RETVAL = THIS->GetClientByIndex(index);
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);
} }
XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportGroup) XS(XS_Raid_TeleportGroup) {
{
dXSARGS; dXSARGS;
if (items != 8) if (items != 8)
Perl_croak(aTHX_ "Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)"); Perl_croak(aTHX_
"Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
{ {
Raid * THIS; Raid *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));
uint32 gid = (uint32)SvUV(ST(7)); uint32 gid = (uint32) SvUV(ST(7));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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, gid); THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading, gid);
@ -479,36 +454,34 @@ XS(XS_Raid_TeleportGroup)
} }
XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportRaid) XS(XS_Raid_TeleportRaid) {
{
dXSARGS; dXSARGS;
if (items != 7) if (items != 7)
Perl_croak(aTHX_ "Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)"); Perl_croak(aTHX_
"Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
{ {
Raid * THIS; Raid *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), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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->TeleportRaid(sender, zoneID, 0, x, y, z, heading); THIS->TeleportRaid(sender, zoneID, 0, x, y, z, heading);
@ -517,61 +490,58 @@ XS(XS_Raid_TeleportRaid)
} }
XS(XS_Raid_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetID) XS(XS_Raid_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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_Raid_GetMember); XS(XS_Raid_GetMember);
XS(XS_Raid_GetMember) XS(XS_Raid_GetMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)"); Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)");
{ {
Raid * THIS; Raid *THIS;
Client* RETVAL = nullptr; Client *RETVAL = nullptr;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
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 > 71) if (index < 0 || index > 71)
RETVAL = nullptr; RETVAL = nullptr;
else { else {
if(THIS->members[index].member != nullptr) if (THIS->members[index].member != nullptr)
RETVAL = THIS->members[index].member->CastToClient(); RETVAL = THIS->members[index].member->CastToClient();
} }
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);
} }
@ -580,20 +550,19 @@ XS(XS_Raid_GetMember)
extern "C" extern "C"
#endif #endif
XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */ XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */
XS(boot_Raid) XS(boot_Raid) {
{
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, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$"); newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$"); newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");