From 86c9b6b079f87340dfd2d811766d42adfcbe4a00 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 1 Jul 2018 19:56:02 -0500 Subject: [PATCH] perl_doors.cpp formatting --- zone/perl_doors.cpp | 553 ++++++++++++++++++++------------------------ 1 file changed, 256 insertions(+), 297 deletions(-) diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index 27eacb701..8c4f4ea98 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.cpp @@ -26,7 +26,9 @@ */ #include "../common/features.h" + #ifdef EMBPERL_XS_CLASSES + #include "../common/global_define.h" #include "embperl.h" @@ -41,282 +43,270 @@ #endif XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetDoorDBID) -{ +XS(XS_Doors_GetDoorDBID) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetDoorDBID(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetDoorDBID(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetDoorID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetDoorID) -{ +XS(XS_Doors_GetDoorID) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetDoorID(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetDoorID(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetID) -{ +XS(XS_Doors_GetID) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetID(THIS)"); { - Doors * THIS; - uint16 RETVAL; + Doors *THIS; + uint16 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetEntityID(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetX) -{ +XS(XS_Doors_GetX) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetX(THIS)"); { - Doors * THIS; - float RETVAL; + Doors *THIS; + float RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetPosition().x; - XSprePUSH; PUSHn((double)RETVAL); + XSprePUSH; + PUSHn((double) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetY) -{ +XS(XS_Doors_GetY) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetY(THIS)"); { - Doors * THIS; - float RETVAL; + Doors *THIS; + float RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetPosition().y; - XSprePUSH; PUSHn((double)RETVAL); + XSprePUSH; + PUSHn((double) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetZ) -{ +XS(XS_Doors_GetZ) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetZ(THIS)"); { - Doors * THIS; - float RETVAL; + Doors *THIS; + float RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetPosition().z; - XSprePUSH; PUSHn((double)RETVAL); + XSprePUSH; + PUSHn((double) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetHeading) -{ +XS(XS_Doors_GetHeading) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetHeading(THIS)"); { - Doors * THIS; - float RETVAL; + Doors *THIS; + float RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetPosition().w; - XSprePUSH; PUSHn((double)RETVAL); + XSprePUSH; + PUSHn((double) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetOpenType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetOpenType) -{ +XS(XS_Doors_GetOpenType) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetOpenType(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetOpenType(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetLockpick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetLockpick) -{ +XS(XS_Doors_GetLockpick) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetLockpick(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetLockpick(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetKeyItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetKeyItem) -{ +XS(XS_Doors_GetKeyItem) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetKeyItem(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetKeyItem(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetNoKeyring); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetNoKeyring) -{ +XS(XS_Doors_GetNoKeyring) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, uint8 type)"); { - Doors * THIS; - uint8 type = (uint8)SvUV(ST(1)); + Doors *THIS; + uint8 type = (uint8) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->GetNoKeyring(); @@ -325,76 +315,71 @@ XS(XS_Doors_GetNoKeyring) } XS(XS_Doors_GetIncline); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetIncline) -{ +XS(XS_Doors_GetIncline) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetIncline(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } XS(XS_Doors_GetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetSize) -{ +XS(XS_Doors_GetSize) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)"); { - Doors * THIS; - uint32 RETVAL; + Doors *THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetSize(); - XSprePUSH; PUSHu((UV)RETVAL); + XSprePUSH; + PUSHu((UV) RETVAL); } XSRETURN(1); } - XS(XS_Doors_SetOpenType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetOpenType) -{ +XS(XS_Doors_SetOpenType) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, uint32 open_type)"); { - Doors * THIS; - uint32 type = (uint32)SvUV(ST(1)); + Doors *THIS; + uint32 type = (uint32) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetOpenType(type); @@ -403,22 +388,20 @@ XS(XS_Doors_SetOpenType) } XS(XS_Doors_SetLockpick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetLockpick) -{ +XS(XS_Doors_SetLockpick) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, uint32 lockpick_type)"); { - Doors * THIS; - uint32 type = (uint32)SvUV(ST(1)); + Doors *THIS; + uint32 type = (uint32) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetLockpick(type); @@ -427,22 +410,20 @@ XS(XS_Doors_SetLockpick) } XS(XS_Doors_SetKeyItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetKeyItem) -{ +XS(XS_Doors_SetKeyItem) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, uint32 key_item_id)"); { - Doors * THIS; - uint32 type = (uint32)SvUV(ST(1)); + Doors *THIS; + uint32 type = (uint32) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetKeyItem(type); @@ -451,22 +432,20 @@ XS(XS_Doors_SetKeyItem) } XS(XS_Doors_SetNoKeyring); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetNoKeyring) -{ +XS(XS_Doors_SetNoKeyring) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, uint8 no_key_ring)"); { - Doors * THIS; - uint8 type = (uint8)SvUV(ST(1)); + Doors *THIS; + uint8 type = (uint8) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetNoKeyring(type); @@ -475,22 +454,20 @@ XS(XS_Doors_SetNoKeyring) } XS(XS_Doors_SetIncline); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetIncline) -{ +XS(XS_Doors_SetIncline) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, uint32 incline)"); { - Doors * THIS; - uint32 type = (uint32)SvUV(ST(1)); + Doors *THIS; + uint32 type = (uint32) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetIncline(type); @@ -499,22 +476,20 @@ XS(XS_Doors_SetIncline) } XS(XS_Doors_SetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetSize) -{ +XS(XS_Doors_SetSize) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, uint32 size)"); { - Doors * THIS; - uint32 type = (uint32)SvUV(ST(1)); + Doors *THIS; + uint32 type = (uint32) SvUV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetSize(type); @@ -523,24 +498,22 @@ XS(XS_Doors_SetSize) } XS(XS_Doors_SetLocation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetLocation) -{ +XS(XS_Doors_SetLocation) { dXSARGS; if (items != 4) Perl_croak(aTHX_ "Usage: Doors::SetLocation(THIS, float x, float y, float z)"); { - Doors * THIS; - float x = (float)SvNV(ST(1)); - float y = (float)SvNV(ST(2)); - float z = (float)SvNV(ST(3)); + Doors *THIS; + float x = (float) SvNV(ST(1)); + float y = (float) SvNV(ST(2)); + float z = (float) SvNV(ST(3)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->SetLocation(x, y, z); @@ -549,175 +522,163 @@ XS(XS_Doors_SetLocation) } XS(XS_Doors_SetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetX) -{ +XS(XS_Doors_SetX) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, float x)"); { - Doors * THIS; - float x = (float)SvNV(ST(1)); + Doors *THIS; + float x = (float) SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - auto position = THIS->GetPosition(); - position.x = x; + auto position = THIS->GetPosition(); + position.x = x; THIS->SetPosition(position); } XSRETURN_EMPTY; } XS(XS_Doors_SetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetY) -{ +XS(XS_Doors_SetY) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, float y)"); { - Doors * THIS; - float y = (float)SvNV(ST(1)); + Doors *THIS; + float y = (float) SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - auto position = THIS->GetPosition(); - position.y = y; + auto position = THIS->GetPosition(); + position.y = y; THIS->SetPosition(position); } XSRETURN_EMPTY; } XS(XS_Doors_SetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetZ) -{ +XS(XS_Doors_SetZ) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, float z)"); { - Doors * THIS; - float z = (float)SvNV(ST(1)); + Doors *THIS; + float z = (float) SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); auto position = THIS->GetPosition(); - position.z = z; + position.z = z; THIS->SetPosition(position); } XSRETURN_EMPTY; } XS(XS_Doors_SetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetHeading) -{ +XS(XS_Doors_SetHeading) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, float heading)"); { - Doors * THIS; - float heading = (float)SvNV(ST(1)); + Doors *THIS; + float heading = (float) SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); auto position = THIS->GetPosition(); - position.w = heading; + position.w = heading; THIS->SetPosition(position); } XSRETURN_EMPTY; } XS(XS_Doors_SetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetModelName) -{ +XS(XS_Doors_SetModelName) { dXSARGS; if (items < 1 || items > 2) Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, string name)"); { - Doors * THIS; - char * name = nullptr; + Doors *THIS; + char *name = nullptr; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + 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); } XSRETURN_EMPTY; } XS(XS_Doors_GetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetModelName) -{ +XS(XS_Doors_GetModelName) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::GetModelName(THIS)"); { - Doors * THIS; - Const_char * RETVAL; + Doors *THIS; + Const_char *RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); RETVAL = THIS->GetDoorName(); - sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; + sv_setpv(TARG, RETVAL); + XSprePUSH; + PUSHTARG; } XSRETURN(1); } XS(XS_Doors_CreateDatabaseEntry); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_CreateDatabaseEntry) -{ +XS(XS_Doors_CreateDatabaseEntry) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)"); { - Doors * THIS; + Doors *THIS; if (sv_derived_from(ST(0), "Doors")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(Doors *,tmp); - } - else + IV tmp = SvIV((SV *) SvRV(ST(0))); + THIS = INT2PTR(Doors *, tmp); + } else Perl_croak(aTHX_ "THIS is not of type Doors"); - if(THIS == nullptr) + if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); THIS->CreateDatabaseEntry(); @@ -726,52 +687,50 @@ XS(XS_Doors_CreateDatabaseEntry) } - #ifdef __cplusplus extern "C" #endif XS(boot_Doors); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Doors) -{ +XS(boot_Doors) { dXSARGS; char file[256]; strncpy(file, __FILE__, 256); file[255] = 0; - if(items != 1) + if (items != 1) fprintf(stderr, "boot_quest does not take any arguments."); char buf[128]; //add the strcpy stuff to get rid of const warnings.... - XS_VERSION_BOOTCHECK ; - newXSproto(strcpy(buf, "GetID"),XS_Doors_GetID, file, "$"); - newXSproto(strcpy(buf, "SetModelName"),XS_Doors_SetModelName, file, "$$"); - newXSproto(strcpy(buf, "GetModelName"),XS_Doors_GetModelName, file, "$"); - newXSproto(strcpy(buf, "GetX"),XS_Doors_GetX, file, "$"); - newXSproto(strcpy(buf, "GetY"),XS_Doors_GetY, file, "$"); - newXSproto(strcpy(buf, "GetZ"),XS_Doors_GetZ, file, "$"); - newXSproto(strcpy(buf, "GetHeading"),XS_Doors_GetHeading, file, "$"); - newXSproto(strcpy(buf, "SetX"),XS_Doors_SetX, file, "$$"); - newXSproto(strcpy(buf, "SetY"),XS_Doors_SetY, file, "$$"); - newXSproto(strcpy(buf, "SetZ"),XS_Doors_SetZ, file, "$$"); - newXSproto(strcpy(buf, "SetHeading"),XS_Doors_SetHeading, file, "$$"); - newXSproto(strcpy(buf, "SetLocation"),XS_Doors_SetLocation, file, "$$$$"); - newXSproto(strcpy(buf, "GetDoorDBID"),XS_Doors_GetDoorDBID, file, "$"); - newXSproto(strcpy(buf, "GetDoorID"),XS_Doors_GetDoorID, file, "$"); - newXSproto(strcpy(buf, "SetSize"),XS_Doors_SetSize, file, "$$"); - newXSproto(strcpy(buf, "GetSize"),XS_Doors_GetSize, file, "$"); - newXSproto(strcpy(buf, "SetIncline"),XS_Doors_SetIncline, file, "$$"); - newXSproto(strcpy(buf, "GetIncline"),XS_Doors_GetIncline, file, "$"); - newXSproto(strcpy(buf, "SetOpenType"),XS_Doors_SetOpenType, file, "$$"); - newXSproto(strcpy(buf, "GetOpenType"),XS_Doors_GetOpenType, file, "$"); - newXSproto(strcpy(buf, "SetLockPick"),XS_Doors_SetLockpick, file, "$$"); - newXSproto(strcpy(buf, "GetLockPick"),XS_Doors_GetLockpick, file, "$"); - newXSproto(strcpy(buf, "SetKeyItem"),XS_Doors_SetKeyItem, file, "$$"); - newXSproto(strcpy(buf, "GetKeyItem"),XS_Doors_GetKeyItem, file, "$"); - newXSproto(strcpy(buf, "SetNoKeyring"),XS_Doors_SetNoKeyring, file, "$$"); - newXSproto(strcpy(buf, "GetNoKeyring"),XS_Doors_GetNoKeyring, file, "$"); - newXSproto(strcpy(buf, "CreateDatabaseEntry"),XS_Doors_CreateDatabaseEntry, file, "$"); + XS_VERSION_BOOTCHECK; + newXSproto(strcpy(buf, "GetID"), XS_Doors_GetID, file, "$"); + newXSproto(strcpy(buf, "SetModelName"), XS_Doors_SetModelName, file, "$$"); + newXSproto(strcpy(buf, "GetModelName"), XS_Doors_GetModelName, file, "$"); + newXSproto(strcpy(buf, "GetX"), XS_Doors_GetX, file, "$"); + newXSproto(strcpy(buf, "GetY"), XS_Doors_GetY, file, "$"); + newXSproto(strcpy(buf, "GetZ"), XS_Doors_GetZ, file, "$"); + newXSproto(strcpy(buf, "GetHeading"), XS_Doors_GetHeading, file, "$"); + newXSproto(strcpy(buf, "SetX"), XS_Doors_SetX, file, "$$"); + newXSproto(strcpy(buf, "SetY"), XS_Doors_SetY, file, "$$"); + newXSproto(strcpy(buf, "SetZ"), XS_Doors_SetZ, file, "$$"); + newXSproto(strcpy(buf, "SetHeading"), XS_Doors_SetHeading, file, "$$"); + newXSproto(strcpy(buf, "SetLocation"), XS_Doors_SetLocation, file, "$$$$"); + newXSproto(strcpy(buf, "GetDoorDBID"), XS_Doors_GetDoorDBID, file, "$"); + newXSproto(strcpy(buf, "GetDoorID"), XS_Doors_GetDoorID, file, "$"); + newXSproto(strcpy(buf, "SetSize"), XS_Doors_SetSize, file, "$$"); + newXSproto(strcpy(buf, "GetSize"), XS_Doors_GetSize, file, "$"); + newXSproto(strcpy(buf, "SetIncline"), XS_Doors_SetIncline, file, "$$"); + newXSproto(strcpy(buf, "GetIncline"), XS_Doors_GetIncline, file, "$"); + newXSproto(strcpy(buf, "SetOpenType"), XS_Doors_SetOpenType, file, "$$"); + newXSproto(strcpy(buf, "GetOpenType"), XS_Doors_GetOpenType, file, "$"); + newXSproto(strcpy(buf, "SetLockPick"), XS_Doors_SetLockpick, file, "$$"); + newXSproto(strcpy(buf, "GetLockPick"), XS_Doors_GetLockpick, file, "$"); + newXSproto(strcpy(buf, "SetKeyItem"), XS_Doors_SetKeyItem, file, "$$"); + newXSproto(strcpy(buf, "GetKeyItem"), XS_Doors_GetKeyItem, file, "$"); + newXSproto(strcpy(buf, "SetNoKeyring"), XS_Doors_SetNoKeyring, file, "$$"); + newXSproto(strcpy(buf, "GetNoKeyring"), XS_Doors_GetNoKeyring, file, "$"); + newXSproto(strcpy(buf, "CreateDatabaseEntry"), XS_Doors_CreateDatabaseEntry, file, "$"); XSRETURN_YES; } #endif //EMBPERL_XS_CLASSES