Re: [NEWBIE]DG bug (again)

From: Peter d (death_comes_to_all@hotmail.com)
Date: 09/10/02


>int real_trigger(int vnum)
>{
>   int bot = 0, mid;
>   int top = top_of_trigt;
>
>   /* perform binary search on trigger-table */
>   for (;;) {
>     mid = (bot + top) / 2;
>
>+    if (bot >= top)
>+      return (NOTHING);
>     if (trig_index[mid]->vnum == vnum)
>       return (mid);
>-    if (bot >= top)
>-      return (NOTHING);
>     if (trig_index[mid]->vnum > vnum)
>       top = mid - 1;
>     else
>       bot = mid + 1;
>   }
>}
>
>Basically what could happen was that mid pointed to a nonexistant
>trigger so 'trig_index[mid]->vnum == vnum' would crash. With this
>fix the function will return correctly. (I think :p)

Hey, you're the man!
that even fixed my trigedit save problem :)
thanx, now it works like it should, everyone with the same problem as i had,
looky here, this is the fix.

_________________________________________________________________
Skicka snabbmeddelanden till dina všnner online med MSN Messenger:
http://messenger.msn.se

--
   +---------------------------------------------------------------+
   | 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