> i've posted this before, but didn't get much help..
> whenever i try to use trigedit, and save afterwards, the mud
> crashes.. now i found another bug with trigedit, when i try
> to edit a vnum that does not exist, it crashes.. i tried to
> redo the hand-patching.. took me a lot of time.. but no good..
I had the 'crashing on new vnum' bug as well. I bet your mud
crashes on the real_trigger function in dg_scripts.c.
The binary search in that function is flawed I think. Here is
the standard one with fix:
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)
Ronald
--
+---------------------------------------------------------------+
| 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