Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Copying affects?

Copying affects?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by AlaricX   (23 posts)  Bio
Date Mon 01 Jul 2002 12:52 AM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 03 Jul 2002 12:06 AM (UTC)
Message
I'm a bit worried about the LINK line, it looks like you are linking the new affect to the old object.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Chris L   USA  (57 posts)  Bio
Date Reply #2 on Wed 03 Jul 2002 04:41 PM (UTC)

Amended on Wed 03 Jul 2002 04:42 PM (UTC) by Chris L

Message
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? =)
Top

Posted by AlaricX   (23 posts)  Bio
Date Reply #3 on Sat 06 Jul 2002 10:01 PM (UTC)
Message
Nope, that didnt work. thanks for the effort. still open for ideas

-AX
Top

Posted by Chris L   USA  (57 posts)  Bio
Date Reply #4 on Sun 07 Jul 2002 02:28 AM (UTC)
Message
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 =)
Top

Posted by AlaricX   (23 posts)  Bio
Date Reply #5 on Sun 07 Jul 2002 02:40 AM (UTC)
Message
Didnt copy affects. sorry for the brief elasticity.

--AX
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 07 Jul 2002 10:43 PM (UTC)
Message
What is "weapon"? The old object or the new one?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,824 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.