Re: Problem with displaying room VNUM in prompt.

From: Jeremy Elson (jelson@blaze.cs.jhu.edu)
Date: 02/12/95


> I'm having a problem with Circle 3.0bpl4 running under Ultrix v4.4 with 
> gcc 2.5.8.  The following seems to work fine under Linux, however, if I 
> have this code installed on the Ultrix system the MUD core dumps right 
> after the player connects and enters their name.  They don't get a 
> password prompt.  I haven't gotten a chance to look over the core file yet
> but thought I'd throw it up here to see if anyone has any quick fixes:

The problem, I think, is that you're trying to dereference d->character
for all descriptors, even though d->character is NULL for some descriptors.
Here is some corrected, untested code.  The only change I changed is the
place where you've declared rm.


> void make_prompt(struct descriptor_data * d)
> {
>   if (d->str)
>     write_to_descriptor(d->descriptor, "] ");
>   else if (d->showstr_point)
>     write_to_descriptor(d->descriptor,
> 			"\r\n*** Press return to continue, q to quit ***");
>   else if (!d->connected) {
>     char prompt[MAX_INPUT_LENGTH];
>     struct room_data *rm = &world[d->character->in_room];
> 
>     *prompt = '\0';
> 
>     if (PRF_FLAGGED(d->character, PRF_DISPHP))
>       sprintf(prompt, "%s%dhp ", prompt, GET_HIT(d->character));
> 
>     if (PRF_FLAGGED(d->character, PRF_DISPMANA))
>       sprintf(prompt, "%s%dma ", prompt, GET_MANA(d->character));
> 
>     if (PRF_FLAGGED(d->character, PRF_DISPMOVE))
>       sprintf(prompt, "%s%dmv ", prompt, GET_MOVE(d->character));
> 
>     if (GET_LEVEL(d->character) >= LVL_IMMORT)        /* Added 2/10/95 */
>       sprintf(prompt, "%s%drm ", prompt, rm->number);
> 
>     if (GET_INVIS_LEV(d->character))
>       sprintf(prompt, "%si%d ", prompt, GET_INVIS_LEV(d->character));
> 
>     strcat(prompt, "> ");
>     write_to_descriptor(d->descriptor, prompt);
>   }
> }
> 



This archive was generated by hypermail 2b30 : 12/07/00 PST