mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Merge pull request #1205 from EQEmu/perl_doors_macro
[Quest API] Perl Doors Validation Macro
This commit is contained in:
commit
369461f9e1
@ -42,6 +42,19 @@
|
|||||||
#undef THIS
|
#undef THIS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define VALIDATE_THIS_IS_DOOR \
|
||||||
|
do { \
|
||||||
|
if (sv_derived_from(ST(0), "Doors")) { \
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0))); \
|
||||||
|
THIS = INT2PTR(Doors*, tmp); \
|
||||||
|
} else { \
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type Doors"); \
|
||||||
|
} \
|
||||||
|
if (THIS == nullptr) { \
|
||||||
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \
|
||||||
|
} \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */
|
XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */
|
||||||
XS(XS_Doors_GetDoorDBID) {
|
XS(XS_Doors_GetDoorDBID) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -51,15 +64,7 @@ XS(XS_Doors_GetDoorDBID) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetDoorDBID();
|
RETVAL = THIS->GetDoorDBID();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -76,15 +81,7 @@ XS(XS_Doors_GetDoorID) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetDoorID();
|
RETVAL = THIS->GetDoorID();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -101,15 +98,7 @@ XS(XS_Doors_GetID) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint16 RETVAL;
|
uint16 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetEntityID();
|
RETVAL = THIS->GetEntityID();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -126,15 +115,7 @@ XS(XS_Doors_GetX) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float RETVAL;
|
float RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetPosition().x;
|
RETVAL = THIS->GetPosition().x;
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHn((double) RETVAL);
|
PUSHn((double) RETVAL);
|
||||||
@ -151,15 +132,7 @@ XS(XS_Doors_GetY) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float RETVAL;
|
float RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetPosition().y;
|
RETVAL = THIS->GetPosition().y;
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHn((double) RETVAL);
|
PUSHn((double) RETVAL);
|
||||||
@ -176,15 +149,7 @@ XS(XS_Doors_GetZ) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float RETVAL;
|
float RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetPosition().z;
|
RETVAL = THIS->GetPosition().z;
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHn((double) RETVAL);
|
PUSHn((double) RETVAL);
|
||||||
@ -201,15 +166,7 @@ XS(XS_Doors_GetHeading) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float RETVAL;
|
float RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetPosition().w;
|
RETVAL = THIS->GetPosition().w;
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHn((double) RETVAL);
|
PUSHn((double) RETVAL);
|
||||||
@ -226,15 +183,7 @@ XS(XS_Doors_GetOpenType) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetOpenType();
|
RETVAL = THIS->GetOpenType();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -251,15 +200,7 @@ XS(XS_Doors_GetLockpick) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetLockpick();
|
RETVAL = THIS->GetLockpick();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -276,15 +217,7 @@ XS(XS_Doors_GetKeyItem) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetKeyItem();
|
RETVAL = THIS->GetKeyItem();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -300,15 +233,7 @@ XS(XS_Doors_GetNoKeyring) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint8 type = (uint8) SvUV(ST(1));
|
uint8 type = (uint8) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->GetNoKeyring();
|
THIS->GetNoKeyring();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -323,15 +248,7 @@ XS(XS_Doors_GetIncline) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetIncline();
|
RETVAL = THIS->GetIncline();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -348,15 +265,7 @@ XS(XS_Doors_GetSize) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 RETVAL;
|
uint32 RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetSize();
|
RETVAL = THIS->GetSize();
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHu((UV) RETVAL);
|
PUSHu((UV) RETVAL);
|
||||||
@ -373,15 +282,7 @@ XS(XS_Doors_SetOpenType) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 type = (uint32) SvUV(ST(1));
|
uint32 type = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetOpenType(type);
|
THIS->SetOpenType(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -395,15 +296,7 @@ XS(XS_Doors_SetLockpick) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 type = (uint32) SvUV(ST(1));
|
uint32 type = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetLockpick(type);
|
THIS->SetLockpick(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -417,15 +310,7 @@ XS(XS_Doors_SetKeyItem) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 type = (uint32) SvUV(ST(1));
|
uint32 type = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetKeyItem(type);
|
THIS->SetKeyItem(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -439,15 +324,7 @@ XS(XS_Doors_SetNoKeyring) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint8 type = (uint8) SvUV(ST(1));
|
uint8 type = (uint8) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetNoKeyring(type);
|
THIS->SetNoKeyring(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -461,15 +338,7 @@ XS(XS_Doors_SetIncline) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 type = (uint32) SvUV(ST(1));
|
uint32 type = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetIncline(type);
|
THIS->SetIncline(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -483,15 +352,7 @@ XS(XS_Doors_SetSize) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
uint32 type = (uint32) SvUV(ST(1));
|
uint32 type = (uint32) SvUV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetSize(type);
|
THIS->SetSize(type);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -507,15 +368,7 @@ XS(XS_Doors_SetLocation) {
|
|||||||
float x = (float) SvNV(ST(1));
|
float x = (float) SvNV(ST(1));
|
||||||
float y = (float) SvNV(ST(2));
|
float y = (float) SvNV(ST(2));
|
||||||
float z = (float) SvNV(ST(3));
|
float z = (float) SvNV(ST(3));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetLocation(x, y, z);
|
THIS->SetLocation(x, y, z);
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
@ -529,14 +382,7 @@ XS(XS_Doors_SetX) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float x = (float) SvNV(ST(1));
|
float x = (float) SvNV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
auto position = THIS->GetPosition();
|
auto position = THIS->GetPosition();
|
||||||
position.x = x;
|
position.x = x;
|
||||||
THIS->SetPosition(position);
|
THIS->SetPosition(position);
|
||||||
@ -552,15 +398,7 @@ XS(XS_Doors_SetY) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float y = (float) SvNV(ST(1));
|
float y = (float) SvNV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
auto position = THIS->GetPosition();
|
auto position = THIS->GetPosition();
|
||||||
position.y = y;
|
position.y = y;
|
||||||
THIS->SetPosition(position);
|
THIS->SetPosition(position);
|
||||||
@ -576,15 +414,7 @@ XS(XS_Doors_SetZ) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float z = (float) SvNV(ST(1));
|
float z = (float) SvNV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
auto position = THIS->GetPosition();
|
auto position = THIS->GetPosition();
|
||||||
position.z = z;
|
position.z = z;
|
||||||
THIS->SetPosition(position);
|
THIS->SetPosition(position);
|
||||||
@ -600,15 +430,7 @@ XS(XS_Doors_SetHeading) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
float heading = (float) SvNV(ST(1));
|
float heading = (float) SvNV(ST(1));
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
auto position = THIS->GetPosition();
|
auto position = THIS->GetPosition();
|
||||||
position.w = heading;
|
position.w = heading;
|
||||||
THIS->SetPosition(position);
|
THIS->SetPosition(position);
|
||||||
@ -624,15 +446,7 @@ XS(XS_Doors_SetModelName) {
|
|||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
char *name = nullptr;
|
char *name = nullptr;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
if (items > 1) { name = (char *) SvPV_nolen(ST(1)); }
|
if (items > 1) { name = (char *) SvPV_nolen(ST(1)); }
|
||||||
|
|
||||||
THIS->SetDoorName(name);
|
THIS->SetDoorName(name);
|
||||||
@ -648,15 +462,7 @@ XS(XS_Doors_GetModelName) {
|
|||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
Const_char *RETVAL;
|
Const_char *RETVAL;
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
RETVAL = THIS->GetDoorName();
|
RETVAL = THIS->GetDoorName();
|
||||||
sv_setpv(TARG, RETVAL);
|
sv_setpv(TARG, RETVAL);
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
@ -672,15 +478,7 @@ XS(XS_Doors_CreateDatabaseEntry) {
|
|||||||
Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)");
|
Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)");
|
||||||
{
|
{
|
||||||
Doors *THIS;
|
Doors *THIS;
|
||||||
|
VALIDATE_THIS_IS_DOOR;
|
||||||
if (sv_derived_from(ST(0), "Doors")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Doors *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Doors");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->CreateDatabaseEntry();
|
THIS->CreateDatabaseEntry();
|
||||||
}
|
}
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user