I have another working version of real_trigger, which will be included in
next pl.:
/* returns the real number of the trigger with given virtual number */
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;
/* Thanks to Derek Fisk for fixing this loop */
if (bot > top)
return (NOTHING);
if (trig_index[mid]->vnum == vnum)
return (mid);
if (trig_index[mid]->vnum > vnum)
top = mid - 1;
else
bot = mid + 1;
}
}
The problem causing the 'unknown trigger blah' bugs is due to the fact
that top_of_trigt is actually out of range. Setting top to top_of_trigt-1
seems to take care of it.
Welcor
--
+---------------------------------------------------------------+
| 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