[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  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] Refresh page


Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] 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
[Go to top] top

Posted by Samson   USA  (683 posts)  [Biography] 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/
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] 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
[Go to top] top

Posted by Samson   USA  (683 posts)  [Biography] 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.
[Go to top] 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.


11,412 views.

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

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]