The Title BUG for EmberMUD
Fix Sheet by Rindar (Ron Cole)
(Though this was so easy, I'm not sure I want to take credit for it)
The Bug: A bug that appeared in the original EmberMUD and continues
through 0.29 is the title bug. A character with too long of a title
will crash the game every time they do a SCORE. The reason for this
is that one of the check numbers is off, and so a character with too
long a name and too long of a title will overload the SCORE.
The Check: Create a character with the longest name possible (the
name ASDFGHJKLZXC works well). Then type in the longest title
possible. If the game crashes when this character does a score, you
have the bug.
The Bugfix: I've seen this done a number of ways, from removing
the title entirely from the score to truncates. The one I used was
simply setting the check EmberMUD already does on titles to the
proper value. Here's how:
1) Open act_info.c
2) Find the function "void do_title"
3) Find the line:
if ( strlen(argument) > 45 )
argument[45] = '\0';
4) Change the value 45 to 34 in both lines.
5) Recompile. You are done.
That's it. Below, I've also included the complete function in case
any non-programmer admins just want to pop it in. If you find a
better way to fix it, let me know.
-= Rindar
clogar@concentric.net
** Note: This function is provided "as is" and may be used so long as
1) The author's name is kept at the top of the function (if requested) and
2) all other previous licensing aggreements are abided by. The author
assumes no responsibility for problems that occur through use or install-
ation, including lost wages, bugs, deletions, downtimes, etc... Use at
your own risk. All new code is copyrighted by its author.
New Title Code (in act_info.c):
void do_title( CHAR_DATA *ch, char *argument )
{
char buf[2*MAX_STRING_LENGTH];
if ( IS_NPC(ch) )
return;
if ( argument[0] == '\0' )
{
send_to_char( "Change your title to what?\n\r", ch );
return;
}
if ( strlen(argument) > 34 )
argument[34] = '\0';
smash_tilde( argument );
set_title( ch, argument );
sprintf(buf,"Ok, you are now %s%s.\n\r",ch->name,ch->pcdata->title);
send_to_char( buf, ch );
}