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"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -42,8 +44,7 @@
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)");
@ -53,8 +54,7 @@ XS(XS_Group_DisbandGroup)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -65,8 +65,7 @@ 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)");
@ -78,8 +77,7 @@ XS(XS_Group_IsGroupMember)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -87,8 +85,7 @@ XS(XS_Group_IsGroupMember)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
client = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "client is not of type Mob");
if (client == nullptr)
Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
@ -101,8 +98,7 @@ 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)");
@ -114,8 +110,7 @@ XS(XS_Group_CastGroupSpell)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -123,8 +118,7 @@ XS(XS_Group_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.");
@ -135,8 +129,7 @@ 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)");
@ -148,8 +141,7 @@ XS(XS_Group_SplitExp)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -157,8 +149,7 @@ XS(XS_Group_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.");
@ -169,8 +160,7 @@ 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
Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)");
@ -183,8 +173,7 @@ XS(XS_Group_GroupMessage)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -192,8 +181,7 @@ XS(XS_Group_GroupMessage)
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.");
@ -204,8 +192,7 @@ XS(XS_Group_GroupMessage)
language = 0;
message = (char *) SvPV_nolen(ST(3));
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));
THIS->GroupMessage(sender, 0, 100, message);
}
@ -214,8 +201,7 @@ XS(XS_Group_GroupMessage)
}
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)");
@ -228,8 +214,7 @@ XS(XS_Group_GetTotalGroupDamage)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -237,21 +222,20 @@ XS(XS_Group_GetTotalGroupDamage)
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->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)");
@ -265,8 +249,7 @@ XS(XS_Group_SplitMoney)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -277,8 +260,7 @@ 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)");
@ -289,8 +271,7 @@ XS(XS_Group_SetLeader)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -298,8 +279,7 @@ XS(XS_Group_SetLeader)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
newleader = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "newleader is not of type Mob");
if (newleader == nullptr)
Perl_croak(aTHX_ "newleader is nullptr, avoiding crash.");
@ -310,8 +290,7 @@ 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)");
@ -322,8 +301,7 @@ XS(XS_Group_GetLeader)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -336,8 +314,7 @@ XS(XS_Group_GetLeader)
}
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)");
@ -349,21 +326,21 @@ XS(XS_Group_GetLeaderName)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
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)");
@ -374,8 +351,7 @@ XS(XS_Group_SendHPPacketsTo)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -383,8 +359,7 @@ XS(XS_Group_SendHPPacketsTo)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "newmember is not of type Mob");
if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
@ -395,8 +370,7 @@ 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)");
@ -407,8 +381,7 @@ XS(XS_Group_SendHPPacketsFrom)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -416,8 +389,7 @@ XS(XS_Group_SendHPPacketsFrom)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "newmember is not of type Mob");
if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
@ -428,8 +400,7 @@ 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)");
@ -441,8 +412,7 @@ XS(XS_Group_IsLeader)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -450,8 +420,7 @@ XS(XS_Group_IsLeader)
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV *) SvRV(ST(1)));
leadertest = INT2PTR(Mob *, tmp);
}
else
} else
Perl_croak(aTHX_ "leadertest is not of type Mob");
if (leadertest == nullptr)
Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash.");
@ -464,8 +433,7 @@ 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)");
@ -477,21 +445,20 @@ XS(XS_Group_GroupCount)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
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)");
@ -503,24 +470,24 @@ XS(XS_Group_GetHighestLevel)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
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;
@ -533,8 +500,7 @@ XS(XS_Group_TeleportGroup)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -542,8 +508,7 @@ XS(XS_Group_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.");
@ -554,8 +519,7 @@ 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)");
@ -567,21 +531,20 @@ XS(XS_Group_GetID)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
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)");
@ -594,8 +557,7 @@ XS(XS_Group_GetMember)
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
}
else
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -619,8 +581,7 @@ 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);