View Single Post
  #5  
Old 06-22-2009, 01:25 AM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

this is exactly what i did:


use with a command like :
$client->AddSpentAAPoints(2);

perl_client.cpp

insert at line 4148
Code:
newXSproto(strcpy(buf, "AddSpentAAPoints"), XS_Client_AddSpentAAPoints, file, "$$");
i put it at line 3621 (arbitrary?)

Code:
XS(XS_Client_AddSpentAAPoints);
XS(XS_Client_AddSpentAAPoints) {
	dXSARGS;
	if(items != 2)
		Perl_croak(aTHX_ "Usage: Client::AddSpentAAPoints(THIS, points)");
	{
		Client * THIS;
		uint32 points = SvUV(ST(1));
		
		if (sv_derived_from(ST(0), "Client")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(Client *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type Client");
		if(THIS == NULL)
			Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");

		THIS->GetPP().aapoints_spent = THIS->GetPP().aapoints_spent + points;
		THIS->SendAAStats();
	}
	XSRETURN_EMPTY;
}
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote