Copying affects?

Posted by AlaricX on Mon 01 Jul 2002 12:52 AM — 7 posts, 24,731 views.

#0
How would i copy affects from one obj to another? the code i have segfaults on quit, save, and drop (afaik), my current code is

for(paf = gem->first_affect; paf; paf = next_aff)
{
CREATE(paf2, AFFECT_DATA, 1);
paf2->type = paf->type;
paf2->duration = paf->duration;
paf2->location = paf->location;
paf2->modifier = paf->modifier;
xCLEAR_BITS(paf2->bitvector);
paf2->next = NULL;
LINK(paf, weapon->first_affect, weapon->last_affect, next, prev);
next_aff = paf->next;
}


(it is imbue code, take effects from a gem at a ceratin wear location adn put them on a weapon, extract the gem and make the weapon like: A/An (x) imbued (x) using myobj so its not like A ruby imbued a finely honed sword) any help is appreciated, thanks
Australia Forum Administrator #1
I'm a bit worried about the LINK line, it looks like you are linking the new affect to the old object.
USA #2
k heres a shot

if ( gem->first_affect )
for ( paf = gem->first_affect; paf; paf = paf->next )
{
CREATE( paf2, AFFECT_DATA, 1 );
paf2->type = paf->type;
paf2->duration = paf->duration;
paf2->location = paf->location;
paf2->modifier = paf->modifier;
paf2->bitvector = paf->bitvector;
paf2->next = NULL;
paf2->prev = NULL;

LINK( paf2, weapon->first_affect, weapon->last_affect, next, prev );
top_affect++;
}

work? or did i miss/add something? =)
Amended on Wed 03 Jul 2002 04:42 PM by Chris L
#3
Nope, that didnt work. thanks for the effort. still open for ideas

-AX
USA #4
what didnt work? was there an error or did it not add the affects, if it was a error what was it? elaborate a lil =)
#5
Didnt copy affects. sorry for the brief elasticity.

--AX
Australia Forum Administrator #6
What is "weapon"? The old object or the new one?