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
➜ Compiling the server
➜ Access violation with morphed characters
|
Access violation with morphed characters
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Fri 25 Nov 2005 08:48 PM (UTC) Amended on Fri 25 Nov 2005 08:50 PM (UTC) by Nick Gammon
|
| Message
| Samson,
There seems to be a problem with using morph in SMAUG. I was playing with polymorph recently, and created a new polymorph, like this:
morphcreate fish
Then I used it on myself:
c polymorph fish
However if I then do something like:
goto some-player-name
MUD crash!
It appears from using gdb that the problem is here:
while( ( *point = *i ) != '\0' )
++point, ++i;
This is line 3006 of comm.c, inside act_string function.
The reason for the crash is "i" is NULL.
The reason i is NULL is this define:
#define MORPHNAME(ch) ((ch->morph&&ch->morph->morph)? \
ch->morph->morph->short_desc: \
IS_NPC(ch) ? ch->short_descr : ch->name)
In my example, I hadn't set up morph->short_desc and thus it was NULL.
I suggest a change of either:
- Making the define fallback to the name if the short description is NULL; or
- Make morphcreate supply a default short name (eg. the morph name).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #1 on Sun 04 Dec 2005 01:42 AM (UTC) Amended on Tue 11 Mar 2008 03:21 AM (UTC) by Nick Gammon
|
| Message
| http://forums.smaugfuss.org/index.php?a=topic&t=495
Interesting results from trying to fix it. Don't know why but that MORPHNAME macro/function is not enough by itself to fix this problem. After changing it to a function so I could see it in backtrace, I was baffled to see that the code path was never executed ( unless it was optimized away? ). So the i variable was always NULL even when it clearly should not have been.
The second listed change in that fix was ultimately what allowed it to work, but I've gone ahead and included them both in the distro just in case.
[EDIT - 11 March 2008] - The Smaug FUSS site is now http://www.smaugmuds.org/ | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Sun 04 Dec 2005 02:26 AM (UTC) |
| Message
| I would have thought that the line:
#define NAME(ch) ( IS_NPC(ch) ? ch->short_descr : ch->name )
would need to read:
#define NAME(ch) ( IS_NPC(ch) && ch->short_descr ? ch->short_descr : ch->name )
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #3 on Mon 05 Dec 2005 11:27 AM (UTC) |
| Message
| | You may well be right about that. Can't hurt in any case. I'm just wondering why it is the MORPHNAME one was never touched. | | 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,038 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top