Gammon Forum
Entire forum
SMAUG
SMAUG coding
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,000 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,000 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.
16,008 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.