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,8 +45,7 @@
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)");
@ -56,8 +57,7 @@ XS(XS_Raid_IsRaidMember)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -70,8 +70,7 @@ XS(XS_Raid_IsRaidMember)
}
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)");
@ -84,8 +83,7 @@ XS(XS_Raid_CastGroupSpell)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -93,8 +91,7 @@ XS(XS_Raid_CastGroupSpell)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "caster is not of type Mob");
if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
@ -105,8 +102,7 @@ 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)");
@ -119,21 +115,20 @@ XS(XS_Raid_GroupCount)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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)");
@ -145,21 +140,20 @@ XS(XS_Raid_RaidCount)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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)");
@ -172,21 +166,20 @@ XS(XS_Raid_GetGroup)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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])");
@ -198,8 +191,7 @@ XS(XS_Raid_SplitExp)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -207,8 +199,7 @@ XS(XS_Raid_SplitExp)
if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "other is not of type Mob");
if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
@ -219,8 +210,7 @@ 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])");
@ -233,8 +223,7 @@ XS(XS_Raid_GetTotalRaidDamage)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -242,21 +231,20 @@ XS(XS_Raid_GetTotalRaidDamage)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "other is not of type Mob");
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)");
@ -270,8 +258,7 @@ XS(XS_Raid_SplitMoney)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -282,8 +269,7 @@ 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)");
@ -295,8 +281,7 @@ XS(XS_Raid_BalanceHP)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -307,8 +292,7 @@ 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)");
@ -320,8 +304,7 @@ XS(XS_Raid_IsLeader)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -334,8 +317,7 @@ XS(XS_Raid_IsLeader)
}
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)");
@ -347,8 +329,7 @@ XS(XS_Raid_IsGroupLeader)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -361,8 +342,7 @@ XS(XS_Raid_IsGroupLeader)
}
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)");
@ -374,21 +354,20 @@ XS(XS_Raid_GetHighestLevel)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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)");
@ -400,21 +379,20 @@ XS(XS_Raid_GetLowestLevel)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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)");
@ -426,8 +404,7 @@ XS(XS_Raid_GetClientByIndex)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -440,11 +417,11 @@ XS(XS_Raid_GetClientByIndex)
}
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;
@ -458,8 +435,7 @@ XS(XS_Raid_TeleportGroup)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -467,8 +443,7 @@ XS(XS_Raid_TeleportGroup)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
@ -479,11 +454,11 @@ 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;
@ -496,8 +471,7 @@ XS(XS_Raid_TeleportRaid)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -505,8 +479,7 @@ XS(XS_Raid_TeleportRaid)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
@ -517,8 +490,7 @@ 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)");
@ -530,21 +502,20 @@ XS(XS_Raid_GetID)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
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)");
@ -556,8 +527,7 @@ XS(XS_Raid_GetMember)
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -580,8 +550,7 @@ 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);