mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
[Quest API] Perl Corpse Validation Macro
Add validation macro to all corpse methods.
This commit is contained in:
parent
9b8845949e
commit
a29de5963f
@ -42,6 +42,18 @@
|
|||||||
#undef THIS
|
#undef THIS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define VALIDATE_THIS_IS_CORPSE \
|
||||||
|
do { \
|
||||||
|
if (sv_derived_from(ST(0), "Corpse")) { \
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0))); \
|
||||||
|
THIS = INT2PTR(Corpse*, tmp); \
|
||||||
|
} else { \
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type Corpse"); \
|
||||||
|
} \
|
||||||
|
if (THIS == nullptr) { \
|
||||||
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \
|
||||||
|
} \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
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) {
|
||||||
@ -52,15 +64,7 @@ XS(XS_Corpse_GetCharID) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetCharID();
|
RETVAL = THIS->GetCharID();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -77,15 +81,7 @@ XS(XS_Corpse_GetDecayTime) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetDecayTime();
|
RETVAL = THIS->GetDecayTime();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -100,15 +96,7 @@ XS(XS_Corpse_Lock) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::Lock(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::Lock(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->Lock();
|
THIS->Lock();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -121,15 +109,7 @@ XS(XS_Corpse_UnLock) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::UnLock(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::UnLock(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->UnLock();
|
THIS->UnLock();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -143,15 +123,7 @@ XS(XS_Corpse_IsLocked) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
bool RETVAL;
|
bool RETVAL;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->IsLocked();
|
RETVAL = THIS->IsLocked();
|
||||||
ST(0) = boolSV(RETVAL);
|
ST(0) = boolSV(RETVAL);
|
||||||
sv_2mortal(ST(0));
|
sv_2mortal(ST(0));
|
||||||
@ -166,15 +138,7 @@ XS(XS_Corpse_ResetLooter) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->ResetLooter();
|
THIS->ResetLooter();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -189,15 +153,7 @@ XS(XS_Corpse_GetDBID) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetCorpseDBID();
|
RETVAL = THIS->GetCorpseDBID();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -214,15 +170,7 @@ XS(XS_Corpse_GetOwnerName) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
char *RETVAL;
|
char *RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetOwnerName();
|
RETVAL = THIS->GetOwnerName();
|
||||||
sv_setpv(TARG, RETVAL);
|
sv_setpv(TARG, RETVAL);
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
@ -239,15 +187,7 @@ XS(XS_Corpse_SetDecayTimer) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 decaytime = (uint32) SvUV(ST(1));
|
uint32 decaytime = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetDecayTimer(decaytime);
|
THIS->SetDecayTimer(decaytime);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -261,15 +201,7 @@ XS(XS_Corpse_IsEmpty) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
bool RETVAL;
|
bool RETVAL;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->IsEmpty();
|
RETVAL = THIS->IsEmpty();
|
||||||
ST(0) = boolSV(RETVAL);
|
ST(0) = boolSV(RETVAL);
|
||||||
sv_2mortal(ST(0));
|
sv_2mortal(ST(0));
|
||||||
@ -287,15 +219,7 @@ XS(XS_Corpse_AddItem) {
|
|||||||
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;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
if (items < 4)
|
if (items < 4)
|
||||||
slot = 0;
|
slot = 0;
|
||||||
else {
|
else {
|
||||||
@ -317,15 +241,7 @@ XS(XS_Corpse_GetWornItem) {
|
|||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
int16 equipSlot = (int16) SvIV(ST(1));
|
int16 equipSlot = (int16) SvIV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetWornItem(equipSlot);
|
RETVAL = THIS->GetWornItem(equipSlot);
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -341,15 +257,7 @@ XS(XS_Corpse_RemoveItem) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint16 lootslot = (uint16) SvUV(ST(1));
|
uint16 lootslot = (uint16) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->RemoveItem(lootslot);
|
THIS->RemoveItem(lootslot);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -366,15 +274,7 @@ XS(XS_Corpse_SetCash) {
|
|||||||
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));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -387,15 +287,7 @@ XS(XS_Corpse_RemoveCash) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::RemoveCash(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::RemoveCash(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->RemoveCash();
|
THIS->RemoveCash();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -410,15 +302,7 @@ XS(XS_Corpse_CountItems) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->CountItems();
|
RETVAL = THIS->CountItems();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -433,15 +317,7 @@ XS(XS_Corpse_Delete) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->Delete();
|
THIS->Delete();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -456,15 +332,7 @@ XS(XS_Corpse_GetCopper) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetCopper();
|
RETVAL = THIS->GetCopper();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -481,15 +349,7 @@ XS(XS_Corpse_GetSilver) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetSilver();
|
RETVAL = THIS->GetSilver();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -506,15 +366,7 @@ XS(XS_Corpse_GetGold) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetGold();
|
RETVAL = THIS->GetGold();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -531,15 +383,7 @@ XS(XS_Corpse_GetPlatinum) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetPlatinum();
|
RETVAL = THIS->GetPlatinum();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -556,15 +400,7 @@ XS(XS_Corpse_Summon) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
Client *client;
|
Client *client;
|
||||||
bool spell = (bool) SvTRUE(ST(2));
|
bool spell = (bool) SvTRUE(ST(2));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
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);
|
||||||
@ -587,15 +423,7 @@ XS(XS_Corpse_CastRezz) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
uint16 spellid = (uint16) SvUV(ST(1));
|
uint16 spellid = (uint16) SvUV(ST(1));
|
||||||
Mob *Caster;
|
Mob *Caster;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
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);
|
||||||
@ -616,15 +444,7 @@ XS(XS_Corpse_CompleteRezz) {
|
|||||||
Perl_croak(aTHX_ "Usage: Corpse::CompleteRezz(THIS)");
|
Perl_croak(aTHX_ "Usage: Corpse::CompleteRezz(THIS)");
|
||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->CompleteResurrection();
|
THIS->CompleteResurrection();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -639,15 +459,7 @@ XS(XS_Corpse_CanMobLoot) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
bool RETVAL;
|
bool RETVAL;
|
||||||
int charid = (int) SvIV(ST(1));
|
int charid = (int) SvIV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->CanPlayerLoot(charid);
|
RETVAL = THIS->CanPlayerLoot(charid);
|
||||||
ST(0) = boolSV(RETVAL);
|
ST(0) = boolSV(RETVAL);
|
||||||
sv_2mortal(ST(0));
|
sv_2mortal(ST(0));
|
||||||
@ -664,15 +476,7 @@ XS(XS_Corpse_AllowMobLoot) {
|
|||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
Mob *them;
|
Mob *them;
|
||||||
uint8 slot = (uint8) SvUV(ST(2));
|
uint8 slot = (uint8) SvUV(ST(2));
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
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);
|
||||||
@ -694,15 +498,7 @@ XS(XS_Corpse_AddLooter) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
Mob *who;
|
Mob *who;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
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);
|
||||||
@ -724,15 +520,7 @@ XS(XS_Corpse_IsRezzed) {
|
|||||||
{
|
{
|
||||||
Corpse *THIS;
|
Corpse *THIS;
|
||||||
bool RETVAL;
|
bool RETVAL;
|
||||||
|
VALIDATE_THIS_IS_CORPSE;
|
||||||
if (sv_derived_from(ST(0), "Corpse")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Corpse *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->IsRezzed();
|
RETVAL = THIS->IsRezzed();
|
||||||
ST(0) = boolSV(RETVAL);
|
ST(0) = boolSV(RETVAL);
|
||||||
sv_2mortal(ST(0));
|
sv_2mortal(ST(0));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user