More work on Granting, incrementaa now uses grant internally which should make it work more consistently with its old behavior

This commit is contained in:
KimLS
2015-06-23 12:53:46 -07:00
parent ce5e185738
commit a41570677f
5 changed files with 70 additions and 84 deletions
+9 -4
View File
@@ -4898,13 +4898,14 @@ XS(XS_Client_GrantAlternateAdvancementAbility); /* prototype to pass -Wmissing-p
XS(XS_Client_GrantAlternateAdvancementAbility)
{
dXSARGS;
if(items != 3)
Perl_croak(aTHX_ "Usage: Client::GrantAlternateAdvancementAbility(THIS, aa_id, points)");
if(items < 3 || items > 4)
Perl_croak(aTHX_ "Usage: Client::GrantAlternateAdvancementAbility(THIS, aa_id, points, [ignore_cost])");
{
Client * THIS;
bool RETVAL;
int aa_id = (int)SvIV(ST(1));
int points = (int)SvIV(ST(2));
bool ignore_cost = false;
if(sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -4915,7 +4916,11 @@ XS(XS_Client_GrantAlternateAdvancementAbility)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GrantAlternateAdvancementAbility(aa_id, points);
if(items > 3) {
ignore_cost = (bool)SvTRUE(ST(3));
}
RETVAL = THIS->GrantAlternateAdvancementAbility(aa_id, points, ignore_cost);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
@@ -6465,7 +6470,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "GetIP"), XS_Client_GetIP, file, "$");
newXSproto(strcpy(buf, "AddLevelBasedExp"), XS_Client_AddLevelBasedExp, file, "$$;$");
newXSproto(strcpy(buf, "IncrementAA"), XS_Client_IncrementAA, file, "$$");
newXSproto(strcpy(buf, "GrantAlternateAdvancementAbility"), XS_Client_GrantAlternateAdvancementAbility, file, "$$$");
newXSproto(strcpy(buf, "GrantAlternateAdvancementAbility"), XS_Client_GrantAlternateAdvancementAbility, file, "$$$;$");
newXSproto(strcpy(buf, "GetAALevel"), XS_Client_GetAALevel, file, "$$");
newXSproto(strcpy(buf, "MarkCompassLoc"), XS_Client_MarkCompassLoc, file, "$$$$");
newXSproto(strcpy(buf, "ClearCompassMark"), XS_Client_ClearCompassMark, file, "$");