Re: Triggers do not always load

From: Carlton Colter (carlton@COLTER.COM)
Date: 10/08/02


Nevermind.  I found the problem to be in real_trigger..
If I continue to find bugs or fixes, I will continue to post them... usualy
just after I give up, post it, then take a break, it comes to me... what to
look at.  - Carlton

The fixed real_trigger is below and follow the same syntax as real_object.

int real_trigger(int vnum)
{
  int bot = 0, mid;
  int top = top_of_trigt-1;

  /* perform binary search on trigger-table */
  for (;;) {
    mid = (bot + top) / 2;

    if (trig_index[mid]->vnum == vnum)
      return (mid);
    /* By moving this line blow the mud vnum, when the bottom and
       top are equal it still finds it.. */
    if (bot >= top)
      return (NOTHING);
    if (trig_index[mid]->vnum > vnum)
      top = mid - 1;
    else
      bot = mid + 1;
  }
}

--
   +---------------------------------------------------------------+
   | 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/25/03 PDT