[BUG]Help retrieval bug

From: Thomas Arp (t_arp@stofanet.dk)
Date: 01/06/03

Hi everyone.

After having a bit of a problem in my running port, I fired up a sparkling
new stock 3.1 and tested to see if the problem occured there too. As you
may figure, since I'm sending this, it does.

The problem expresses itself like this:

I have two help entries (paraphrased):


If you have roomflags on, you will see this, when you look at the room.

Use this to be somewhere else, sort of.

Now, when I type "HELP AT", I get the help for ATRIUM. I'm interested in
getting the (WIZAT) AT entry. Help loading and finding have been changed
to be faster. Now all we need is for it to work correctly :)

The current do_help looks like this:

  int chk, bot, top, mid, minlen;
  bot = 0;
  top = top_of_helpt;
  minlen = strlen(argument);

  for (;;) {
    mid = (bot + top) / 2;

    if (bot > top) {
      send_to_char(ch, "There is no help on that word.\r\n");
    } else if (!(chk = strn_cmp(argument, help_table[mid].keyword, minlen)))
      /* trace backwards to find first matching entry. Thanks Jeff Fink! */
      while ((mid > 0) &&
  (!(chk = strn_cmp(argument, help_table[mid - 1].keyword, minlen))))
      page_string(ch->desc, help_table[mid].entry, 0);
    } else {
      if (chk > 0)
        bot = mid + 1;
        top = mid - 1;

As I see it, we search binary until we find something that looks right.
Then we step backwards until we find the first in the help_table that
fits the pattern. Now, this is supposed to be AT (since AT\0 is
alphabetically lower than ATR). Where does it go wrong ?

I haven't altered the source files at all. The only changes was the
addition of ATRIUM and AT (which are mere examples).


   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT