perl_player_corpse.cpp formatting

This commit is contained in:
Akkadius 2018-07-01 19:36:47 -05:00
parent 2010d1ba83
commit 88ed2e64bb

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,73 +44,69 @@
XS(XS_Corpse_GetCharID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetCharID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetCharID) XS(XS_Corpse_GetCharID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetCharID(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetCharID(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCharID(); RETVAL = THIS->GetCharID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_GetDecayTime); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetDecayTime); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetDecayTime) XS(XS_Corpse_GetDecayTime) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetDecayTime(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetDecayTime(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDecayTime(); RETVAL = THIS->GetDecayTime();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_Lock); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_Lock); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_Lock) XS(XS_Corpse_Lock) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::Lock(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::Lock(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->Lock(); THIS->Lock();
@ -117,21 +115,19 @@ XS(XS_Corpse_Lock)
} }
XS(XS_Corpse_UnLock); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_UnLock); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_UnLock) XS(XS_Corpse_UnLock) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::UnLock(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::UnLock(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->UnLock(); THIS->UnLock();
@ -140,22 +136,20 @@ XS(XS_Corpse_UnLock)
} }
XS(XS_Corpse_IsLocked); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_IsLocked); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_IsLocked) XS(XS_Corpse_IsLocked) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::IsLocked(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::IsLocked(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
bool RETVAL; bool RETVAL;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsLocked(); RETVAL = THIS->IsLocked();
@ -166,21 +160,19 @@ XS(XS_Corpse_IsLocked)
} }
XS(XS_Corpse_ResetLooter); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_ResetLooter); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_ResetLooter) XS(XS_Corpse_ResetLooter) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->ResetLooter(); THIS->ResetLooter();
@ -189,74 +181,71 @@ XS(XS_Corpse_ResetLooter)
} }
XS(XS_Corpse_GetDBID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetDBID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetDBID) XS(XS_Corpse_GetDBID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetDBID(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetDBID(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCorpseDBID(); RETVAL = THIS->GetCorpseDBID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_GetOwnerName); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetOwnerName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetOwnerName) XS(XS_Corpse_GetOwnerName) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetOwnerName(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetOwnerName(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
char * RETVAL; char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetOwnerName(); RETVAL = THIS->GetOwnerName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_SetDecayTimer); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_SetDecayTimer); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_SetDecayTimer) XS(XS_Corpse_SetDecayTimer) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Corpse::SetDecayTimer(THIS, uint32 decay_time)"); Perl_croak(aTHX_ "Usage: Corpse::SetDecayTimer(THIS, uint32 decay_time)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 decaytime = (uint32)SvUV(ST(1)); uint32 decaytime = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetDecayTimer(decaytime); THIS->SetDecayTimer(decaytime);
@ -265,22 +254,20 @@ XS(XS_Corpse_SetDecayTimer)
} }
XS(XS_Corpse_IsEmpty); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_IsEmpty); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_IsEmpty) XS(XS_Corpse_IsEmpty) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::IsEmpty(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::IsEmpty(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
bool RETVAL; bool RETVAL;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsEmpty(); RETVAL = THIS->IsEmpty();
@ -291,30 +278,28 @@ XS(XS_Corpse_IsEmpty)
} }
XS(XS_Corpse_AddItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_AddItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_AddItem) XS(XS_Corpse_AddItem) {
{
dXSARGS; dXSARGS;
if (items < 3 || items > 4) if (items < 3 || items > 4)
Perl_croak(aTHX_ "Usage: Corpse::AddItem(THIS, uint32 item_id, uint16 charges, [unt16 slot = 0])"); Perl_croak(aTHX_ "Usage: Corpse::AddItem(THIS, uint32 item_id, uint16 charges, [unt16 slot = 0])");
{ {
Corpse * THIS; Corpse *THIS;
uint32 itemnum = (uint32)SvUV(ST(1)); uint32 itemnum = (uint32) SvUV(ST(1));
uint16 charges = (uint16)SvUV(ST(2)); uint16 charges = (uint16) SvUV(ST(2));
int16 slot; int16 slot;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items < 4) if (items < 4)
slot = 0; slot = 0;
else { else {
slot = (int16)SvIV(ST(3)); slot = (int16) SvIV(ST(3));
} }
THIS->AddItem(itemnum, charges, slot); THIS->AddItem(itemnum, charges, slot);
@ -323,49 +308,46 @@ XS(XS_Corpse_AddItem)
} }
XS(XS_Corpse_GetWornItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetWornItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetWornItem) XS(XS_Corpse_GetWornItem) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Corpse::GetWornItem(THIS, equipSlot)"); Perl_croak(aTHX_ "Usage: Corpse::GetWornItem(THIS, equipSlot)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
int16 equipSlot = (int16)SvIV(ST(1)); int16 equipSlot = (int16) SvIV(ST(1));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetWornItem(equipSlot); RETVAL = THIS->GetWornItem(equipSlot);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_RemoveItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_RemoveItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_RemoveItem) XS(XS_Corpse_RemoveItem) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Corpse::RemoveItem(THIS, uint16 loot_slot)"); Perl_croak(aTHX_ "Usage: Corpse::RemoveItem(THIS, uint16 loot_slot)");
{ {
Corpse * THIS; Corpse *THIS;
uint16 lootslot = (uint16)SvUV(ST(1)); uint16 lootslot = (uint16) SvUV(ST(1));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->RemoveItem(lootslot); THIS->RemoveItem(lootslot);
@ -374,25 +356,23 @@ XS(XS_Corpse_RemoveItem)
} }
XS(XS_Corpse_SetCash); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_SetCash); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_SetCash) XS(XS_Corpse_SetCash) {
{
dXSARGS; dXSARGS;
if (items != 5) if (items != 5)
Perl_croak(aTHX_ "Usage: Corpse::SetCash(THIS, uint16 copper, uint16 silver, uint16 gold, uint16 platinum)"); Perl_croak(aTHX_ "Usage: Corpse::SetCash(THIS, uint16 copper, uint16 silver, uint16 gold, uint16 platinum)");
{ {
Corpse * THIS; Corpse *THIS;
uint16 in_copper = (uint16)SvUV(ST(1)); uint16 in_copper = (uint16) SvUV(ST(1));
uint16 in_silver = (uint16)SvUV(ST(2)); uint16 in_silver = (uint16) SvUV(ST(2));
uint16 in_gold = (uint16)SvUV(ST(3)); uint16 in_gold = (uint16) SvUV(ST(3));
uint16 in_platinum = (uint16)SvUV(ST(4)); uint16 in_platinum = (uint16) SvUV(ST(4));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetCash(in_copper, in_silver, in_gold, in_platinum); THIS->SetCash(in_copper, in_silver, in_gold, in_platinum);
@ -401,21 +381,19 @@ XS(XS_Corpse_SetCash)
} }
XS(XS_Corpse_RemoveCash); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_RemoveCash); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_RemoveCash) XS(XS_Corpse_RemoveCash) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::RemoveCash(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::RemoveCash(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->RemoveCash(); THIS->RemoveCash();
@ -424,47 +402,44 @@ XS(XS_Corpse_RemoveCash)
} }
XS(XS_Corpse_CountItems); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_CountItems); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_CountItems) XS(XS_Corpse_CountItems) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::CountItems(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::CountItems(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->CountItems(); RETVAL = THIS->CountItems();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_Delete); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_Delete); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_Delete) XS(XS_Corpse_Delete) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->Delete(); THIS->Delete();
@ -473,136 +448,129 @@ XS(XS_Corpse_Delete)
} }
XS(XS_Corpse_GetCopper); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetCopper); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetCopper) XS(XS_Corpse_GetCopper) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetCopper(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetCopper(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCopper(); RETVAL = THIS->GetCopper();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_GetSilver); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetSilver); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetSilver) XS(XS_Corpse_GetSilver) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetSilver(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetSilver(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSilver(); RETVAL = THIS->GetSilver();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_GetGold); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetGold); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetGold) XS(XS_Corpse_GetGold) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetGold(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetGold(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetGold(); RETVAL = THIS->GetGold();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_GetPlatinum); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_GetPlatinum); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_GetPlatinum) XS(XS_Corpse_GetPlatinum) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::GetPlatinum(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::GetPlatinum(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPlatinum(); RETVAL = THIS->GetPlatinum();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Corpse_Summon); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_Summon); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_Summon) XS(XS_Corpse_Summon) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Corpse::Summon(THIS, Client* client, bool is_spell)"); Perl_croak(aTHX_ "Usage: Corpse::Summon(THIS, Client* client, bool is_spell)");
{ {
Corpse * THIS; Corpse *THIS;
Client* client; Client *client;
bool spell = (bool)SvTRUE(ST(2)); bool spell = (bool) SvTRUE(ST(2));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
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), "Client")) { if (sv_derived_from(ST(1), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
client = INT2PTR(Client *,tmp); client = INT2PTR(Client *, tmp);
} } else
else
Perl_croak(aTHX_ "client is not of type Client"); Perl_croak(aTHX_ "client is not of type Client");
if(client == nullptr) if (client == nullptr)
Perl_croak(aTHX_ "client is nullptr, avoiding crash."); Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
THIS->Summon(client, spell, true); THIS->Summon(client, spell, true);
@ -611,32 +579,29 @@ XS(XS_Corpse_Summon)
} }
XS(XS_Corpse_CastRezz); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_CastRezz); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_CastRezz) XS(XS_Corpse_CastRezz) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Corpse::CastRezz(THIS, uint16 spell_id, [Mob* caster = nullptr])"); Perl_croak(aTHX_ "Usage: Corpse::CastRezz(THIS, uint16 spell_id, [Mob* caster = nullptr])");
{ {
Corpse * THIS; Corpse *THIS;
uint16 spellid = (uint16)SvUV(ST(1)); uint16 spellid = (uint16) SvUV(ST(1));
Mob* Caster; Mob *Caster;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
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)));
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->CastRezz(spellid, Caster); THIS->CastRezz(spellid, Caster);
@ -645,21 +610,19 @@ XS(XS_Corpse_CastRezz)
} }
XS(XS_Corpse_CompleteRezz); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_CompleteRezz); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_CompleteRezz) XS(XS_Corpse_CompleteRezz) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::CompleteRezz(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::CompleteRezz(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->CompleteResurrection(); THIS->CompleteResurrection();
@ -668,23 +631,21 @@ XS(XS_Corpse_CompleteRezz)
} }
XS(XS_Corpse_CanMobLoot); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_CanMobLoot); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_CanMobLoot) XS(XS_Corpse_CanMobLoot) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Corpse::CanMobLoot(THIS, int character_id)"); Perl_croak(aTHX_ "Usage: Corpse::CanMobLoot(THIS, int character_id)");
{ {
Corpse * THIS; Corpse *THIS;
bool RETVAL; bool RETVAL;
int charid = (int)SvIV(ST(1)); int charid = (int) SvIV(ST(1));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->CanPlayerLoot(charid); RETVAL = THIS->CanPlayerLoot(charid);
@ -695,32 +656,29 @@ XS(XS_Corpse_CanMobLoot)
} }
XS(XS_Corpse_AllowMobLoot); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_AllowMobLoot); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_AllowMobLoot) XS(XS_Corpse_AllowMobLoot) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Corpse::AllowMobLoot(THIS, Mob* them, uint8 slot)"); Perl_croak(aTHX_ "Usage: Corpse::AllowMobLoot(THIS, Mob* them, uint8 slot)");
{ {
Corpse * THIS; Corpse *THIS;
Mob * them; Mob *them;
uint8 slot = (uint8)SvUV(ST(2)); uint8 slot = (uint8) SvUV(ST(2));
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
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)));
them = INT2PTR(Mob *,tmp); them = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "them is not of type Mob"); Perl_croak(aTHX_ "them is not of type Mob");
if(them == nullptr) if (them == nullptr)
Perl_croak(aTHX_ "them is nullptr, avoiding crash."); Perl_croak(aTHX_ "them is nullptr, avoiding crash.");
THIS->AllowPlayerLoot(them, slot); THIS->AllowPlayerLoot(them, slot);
@ -729,31 +687,28 @@ XS(XS_Corpse_AllowMobLoot)
} }
XS(XS_Corpse_AddLooter); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_AddLooter); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_AddLooter) XS(XS_Corpse_AddLooter) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Corpse::AddLooter(THIS, Mob* who)"); Perl_croak(aTHX_ "Usage: Corpse::AddLooter(THIS, Mob* who)");
{ {
Corpse * THIS; Corpse *THIS;
Mob * who; Mob *who;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
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)));
who = INT2PTR(Mob *,tmp); who = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "who is not of type Mob"); Perl_croak(aTHX_ "who is not of type Mob");
if(who == nullptr) if (who == nullptr)
Perl_croak(aTHX_ "who is nullptr, avoiding crash."); Perl_croak(aTHX_ "who is nullptr, avoiding crash.");
THIS->AddLooter(who); THIS->AddLooter(who);
@ -762,22 +717,20 @@ XS(XS_Corpse_AddLooter)
} }
XS(XS_Corpse_IsRezzed); /* prototype to pass -Wmissing-prototypes */ XS(XS_Corpse_IsRezzed); /* prototype to pass -Wmissing-prototypes */
XS(XS_Corpse_IsRezzed) XS(XS_Corpse_IsRezzed) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Corpse::IsRezzed(THIS)"); Perl_croak(aTHX_ "Usage: Corpse::IsRezzed(THIS)");
{ {
Corpse * THIS; Corpse *THIS;
bool RETVAL; bool RETVAL;
if (sv_derived_from(ST(0), "Corpse")) { if (sv_derived_from(ST(0), "Corpse")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Corpse *,tmp); THIS = INT2PTR(Corpse *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Corpse"); Perl_croak(aTHX_ "THIS is not of type Corpse");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRezzed(); RETVAL = THIS->IsRezzed();
@ -791,20 +744,19 @@ XS(XS_Corpse_IsRezzed)
extern "C" extern "C"
#endif #endif
XS(boot_Corpse); /* prototype to pass -Wmissing-prototypes */ XS(boot_Corpse); /* prototype to pass -Wmissing-prototypes */
XS(boot_Corpse) XS(boot_Corpse) {
{
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, "GetCharID"), XS_Corpse_GetCharID, file, "$"); newXSproto(strcpy(buf, "GetCharID"), XS_Corpse_GetCharID, file, "$");
newXSproto(strcpy(buf, "GetDecayTime"), XS_Corpse_GetDecayTime, file, "$"); newXSproto(strcpy(buf, "GetDecayTime"), XS_Corpse_GetDecayTime, file, "$");