It's something you'd have to write yourself, but you can do something
like this...
int total, apply;
AFFECT_DATA *paf, *paf_next, *paf_next2;
for ( paf = obj->affected; paf != NULL; paf = paf->next )
{
apply = paf->location;
total = paf->modifier;
for ( paf_next = paf->next; paf_next != NULL; paf_next =
paf_next->next )
{
paf_next2 = paf_next->next;
if ( paf_next == paf->next && paf_next->location ==
paf->location )
{
total += paf_next->modifier;
paf->next = paf_next2;
free_affect(paf_next);
}
if ( paf_next2->location == paf->location )
{
total += paf_next->modifier;
paf_next->next = paf_next2->next;
free_affect(paf_next2);
}
}
paf->modifier = total;
}
I think that should work, in theory anyway, it'll cycle through the
affect list, starting with the first, it'll record that apply number and
check the rest of the list for duplicates... any duplicates it finds
it'll add the modifier to total and destroy that affect, then loop on to
(the newly assigned) next affect in the chain until it hits the end, the
go to the 2nd element in the list and check from there on in the same
way... feel free to point out any bugs you see in this (anyone) as I
kind of thought it up on the fly but would like to put it into mine also
:D
Richard Lindsey
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 12:12 PM
To: [email protected]
Subject: Combining Affects
I want to combine the affects on 2 items.
For example - Item 1 has an 'addaffect' of +100 hp, and Item 2 has an
'addaffect' of +20 hp. When 'combined' by the player, the new item will
have
+120 hp. Is there something in the ROM code that I am missing that does
this,
or I have to write one myself? If so, any help would be good.
Thanks
--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom