new_prompt.diff code -- wierd problems

From: Brian (brian@IMI-BOTTLING.COM)
Date: 03/23/98


Is there anyone out there who has succesfully patched in the
new_prompt.diff patch (replaces the prompt with one that allows custom
prompts, and has a set of 4 default prompts, written by Daniel K.)?

The patch was originally from bpl11, and when I patched it into my bpl12
code, I get some rather odd occurances.

Here they are, in no particular order...

1)  The prompt is sent back right away after a command, and BEFORE the
command is actuated.  For instance... I type "say hello".  WHen I hit
enter, I'll get another copy of the prompt send to me, then it will say
"you say 'hello'", and then there will be a blank, black space under that
where the prompt is supposed to be.

Another example...   type "look".  It will send the prompt back to me, and
THEN send the room description and contents as normal, but then again,
leave a black, blank line where the prompt would normally go.  In short,
it's sending the prompt first, and everything else second.  If I hit ENTER
after doing something, I'll get the prompt back.

2)  Now, this phenomenon also affects the pager-prompt (and I think the
editor prompt (the "]" character during writing messages or OLC editing)).
If I look at a long message, the pager-prompt will appear as normal.
However, once I've done that, anytime I hit ENTER in the future at my
new_prompt HMV prompt, the pager-prompt copies itself over the HMV prompt.
Talking to someone else about this, it seems he thought the has_prompt
might not be getting reset to show that the pager-prompt is no longer
needed.  *shrug* I'm stumped.  I messed with it all weekend, and mostly
just pulled my hair out.  I figured I better try and ask for help on this
one.

At the moment, all I'm asking is if anyone has added the patch to a bpl12
codebase, and how they did it.  If anyone is willing to help, maybe they'll
see something my inexperience is missing.  I'm attaching a few functions
that were changed when I added in the new_prompt patch.  Not sure if these
will help, but it's usually impossible to try to figure something out with
just a small explanation of the problem...

The 200 line limit prevents me from sending too much code, so here's what I
can send...

------------ Here's make_prompt in comm.c ---------------------------------

char *make_prompt(struct descriptor_data *d)
{
  static char prompt[256];

  /* Note, prompt is truncated at MAX_PROMPT_LENGTH chars (structs.h )*/

  /*
   * These two checks were reversed to allow page_string() to work in the
   * online editor.
   */

/* zzz */

  if (d->showstr_count) {
    sprintf(prompt,
     "\r[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number
(%d/%d) ]",
     d->showstr_page, d->showstr_count);
  } else if (d->str)
    strcpy(prompt, "] ");
  else if (!d->connected) {
  write_to_descriptor(d->descriptor, prompt_str(d->character));
} else
    *prompt = '\0';

  return prompt;
}

-------------- End of make_prompt --------------------------


And here's process_output from comm.c.

------------- process_output in comm.c --------------------
/*
* Send all of the output that we've accumulated for a player out to
* the player's descriptor.
* FIXME - This will be rewritten before 3.1, this code is dumb.
*/
int process_output(struct descriptor_data *t)
{
  static char i[MAX_SOCK_BUF];
  static int result;
int clvl=0;
if(t->character) clvl=COLOR_LEV(t->character);

  /* we may need this \r\n for later -- see below */
  strcpy(i, "\r\n");

  /* now, append the 'real' output */
  strcpy(i + 2, t->output);

  /* if we're in the overflow state, notify the user */
  if (t->bufptr < 0)
    strcat(i, "**OVERFLOW**");

  /* add the extra CRLF if the person isn't in compact mode */
  if (!t->connected && t->character && !PRF_FLAGGED(t->character,
PRF_COMPACT))
    strcat(i + 2, "\r\n");

  /*
   * now, send the output.  If this is an 'interruption', use the prepended
   * CRLF, otherwise send the straight output sans CRLF.
   */
proc_color(i,clvl); /* in color.c */ /* ***** This is from easy_color *****
*/

  /* add a prompt */
  strncat(i + 2, make_prompt(t), MAX_PROMPT_LENGTH);

  if (t->has_prompt)  /* && !t->connected) */
    result = write_to_descriptor(t->descriptor, i);
  else
    result = write_to_descriptor(t->descriptor, i + 2);

  /* handle snooping: prepend "% " and send to snooper */
  if (t->snoop_by) {
    SEND_TO_Q("% ", t->snoop_by);
    SEND_TO_Q(t->output, t->snoop_by);
    SEND_TO_Q("%%", t->snoop_by);
  }
  /*
   * if we were using a large buffer, put the large buffer on the buffer
pool
   * and switch back to the small one
   */
  if (t->large_outbuf) {
    t->large_outbuf->next = bufpool;
    bufpool = t->large_outbuf;
    t->large_outbuf = NULL;
    t->output = t->small_outbuf;
  }
  /* reset total bufspace back to that of a small buffer */
  t->bufspace = SMALL_BUFSIZE - 1;
  t->bufptr = 0;
  *(t->output) = '\0';

  return result;
}

---------- end of process_output in comm.c --------------------


There were other files that were modified, but I think the problems is
somewhere in comm.c...  But I'm not sure.  If someone read this far and has
some ideas, please e-mail me!  Thanks.

- Brian


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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