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"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -43,60 +45,55 @@
XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsRaidMember)
{
XS(XS_Raid_IsRaidMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRaidMember(name);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_CastGroupSpell)
{
XS(XS_Raid_CastGroupSpell) {
dXSARGS;
if (items != 4)
Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, Mob* caster, uint16 spell_id, uint32 group_id)");
{
Raid * THIS;
Mob* caster;
uint16 spellid = (uint16)SvUV(ST(2));
uint32 gid = (uint32)SvUV(ST(3));
Raid *THIS;
Mob *caster;
uint16 spellid = (uint16) SvUV(ST(2));
uint32 gid = (uint32) SvUV(ST(3));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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, gid);
@ -105,112 +102,106 @@ XS(XS_Raid_CastGroupSpell)
}
XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GroupCount)
{
XS(XS_Raid_GroupCount) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)");
{
Raid * THIS;
uint8 RETVAL;
Raid *THIS;
uint8 RETVAL;
dXSTARG;
uint32 gid = (uint32)SvUV(ST(1));
uint32 gid = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount(gid);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_RaidCount)
{
XS(XS_Raid_RaidCount) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)");
{
Raid * THIS;
uint8 RETVAL;
Raid *THIS;
uint8 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->RaidCount();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetGroup)
{
XS(XS_Raid_GetGroup) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
const char* name = (char *)SvPV_nolen(ST(1));
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetGroup(name);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitExp)
{
XS(XS_Raid_SplitExp) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, uint32 experience, [Mob* other = nullptr])");
{
Raid * THIS;
uint32 exp = (uint32)SvUV(ST(1));
Mob* other;
Raid *THIS;
uint32 exp = (uint32) SvUV(ST(1));
Mob *other;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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);
@ -219,61 +210,57 @@ XS(XS_Raid_SplitExp)
}
XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetTotalRaidDamage)
{
XS(XS_Raid_GetTotalRaidDamage) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
Mob* other;
Mob *other;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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->GetTotalRaidDamage(other);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitMoney)
{
XS(XS_Raid_SplitMoney) {
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
{
Raid * 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));
Raid *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), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_BalanceHP) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, int32 penalty, uint32 group_id)");
{
Raid * THIS;
int32 penalty = (int32)SvUV(ST(1));
uint32 gid = (uint32)SvUV(ST(2));
Raid *THIS;
int32 penalty = (int32) SvUV(ST(1));
uint32 gid = (uint32) SvUV(ST(2));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->BalanceHP(penalty, gid);
@ -307,170 +292,160 @@ XS(XS_Raid_BalanceHP)
}
XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsLeader)
{
XS(XS_Raid_IsLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(name);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsGroupLeader)
{
XS(XS_Raid_IsGroupLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* who = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *who = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupLeader(who);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetHighestLevel)
{
XS(XS_Raid_GetHighestLevel) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetLowestLevel)
{
XS(XS_Raid_GetLowestLevel) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLowestLevel();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetClientByIndex)
{
XS(XS_Raid_GetClientByIndex) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_indez)");
{
Raid * THIS;
Client * RETVAL;
uint16 index = (uint16)SvUV(ST(1));
Raid *THIS;
Client *RETVAL;
uint16 index = (uint16) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetClientByIndex(index);
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);
}
XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportGroup)
{
XS(XS_Raid_TeleportGroup) {
dXSARGS;
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;
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));
uint32 gid = (uint32)SvUV(ST(7));
Raid *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));
uint32 gid = (uint32) SvUV(ST(7));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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, gid);
@ -479,36 +454,34 @@ XS(XS_Raid_TeleportGroup)
}
XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportRaid)
{
XS(XS_Raid_TeleportRaid) {
dXSARGS;
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;
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));
Raid *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), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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->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)
{
XS(XS_Raid_GetID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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_Raid_GetMember);
XS(XS_Raid_GetMember)
{
XS(XS_Raid_GetMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)");
{
Raid * THIS;
Client* RETVAL = nullptr;
Raid *THIS;
Client *RETVAL = nullptr;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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 > 71)
RETVAL = nullptr;
else {
if(THIS->members[index].member != nullptr)
if (THIS->members[index].member != nullptr)
RETVAL = THIS->members[index].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);
}
@ -580,39 +550,38 @@ XS(XS_Raid_GetMember)
extern "C"
#endif
XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */
XS(boot_Raid)
{
XS(boot_Raid) {
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, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$");
newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$");
newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$");
newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$");
newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$");
newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$");
newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$");
newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$");
newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$");
newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$");
XSRETURN_YES;
}