Update perl_mob.cpp

This commit is contained in:
Paul Coene 2019-04-24 10:10:48 -04:00 committed by GitHub
parent 1603ea097f
commit 7dc1e10956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1135,6 +1135,29 @@ XS(XS_Mob_ChangeSize) {
XSRETURN_EMPTY;
}
+XS(XS_Mob_RandomizeFeatures); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Mob_RandomizeFeatures) {
+ dXSARGS;
+ if (items < 2 || items > 3)
+ Perl_croak(aTHX_ "Usage: Mob::RandomizeFeatures(THIS, bool send_illusion, set_variables)");
+ {
+ Mob *THIS;
+ bool send_illusion = (bool) SvNV(ST(1));
+ bool set_variables = (bool) SvNV(ST(2));
+
+ if (sv_derived_from(ST(0), "Mob")) {
+ IV tmp = SvIV((SV *) SvRV(ST(0)));
+ THIS = INT2PTR(Mob *, tmp);
+ } else
+ Perl_croak(aTHX_ "THIS is not of type Mob");
+ if (THIS == nullptr)
+ Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
+
+ THIS->RandomizeFeatures(send_illusion, set_variables);
+ }
+ XSRETURN_EMPTY;
+}
XS(XS_Mob_GMMove); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GMMove) {
dXSARGS;
@ -6760,7 +6783,7 @@ XS(XS_Mob_SendIllusion) {
dXSARGS;
if (items < 2 || items > 14)
Perl_croak(aTHX_
"Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture = 0xFF], [unit8 helmtexture = 0xFF], [unit8 face = 0xFF], [unit8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color = 0xFF], [uint32 drakkin_heritage = 0xFFFFFFFF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
"Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture face = 0xFF], [uint8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color =FF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
{
Mob *THIS;
uint16 race = (uint16) SvIV(ST(1));
@ -8552,6 +8575,7 @@ XS(boot_Mob) {
newXSproto(strcpy(buf, "SetHP"), XS_Mob_SetHP, file, "$$");
newXSproto(strcpy(buf, "DoAnim"), XS_Mob_DoAnim, file, "$$;$");
newXSproto(strcpy(buf, "ChangeSize"), XS_Mob_ChangeSize, file, "$$;$");
newXSproto(strcpy(buf, "RandomizeFeatures"), XS_Mob_RandomizeFeatures, file, "$$;$");
newXSproto(strcpy(buf, "GMMove"), XS_Mob_GMMove, file, "$$$$;$");
newXSproto(strcpy(buf, "HasProcs"), XS_Mob_HasProcs, file, "$");
newXSproto(strcpy(buf, "IsInvisible"), XS_Mob_IsInvisible, file, "$;$");