Re: [CODE] sedit bug

From: Travis M. Fuller (travis@IAMERICA.NET)
Date: 03/01/98


Michael J. Fara wrote:

> OK I have been running my MUD on a SunOS system for awhile, and I recently
> made the move to a faster system. The new system is Linux..now when I try
> sedit on the MUD the server crashes with no entry in the syslog.CRASH. I
> had common sense enough to run gdb and here is what I got on the core file
>

I dont know if this is your problem but this is what happened to us and our
fix. We run a win95 port btw. When using sedit to make a new shop, we were
fine. However, using to edit an existing shop crashed the mud. When searching
through the shop files, it looks for a -1 so it knows the end of the shop has
been reached, then continues on that way for each shop. Now if the shop files
have been edited outside of the olc(like wordpad or something) the last
character is a 255 which is a line feed. The sedit search bit reads the 255
and deosnt see the -1 as the last character. Therefore, the end of shop is
never reached and the mud crashes. One possible fix is to redo your shop files
all with olc from scratch.Our fix was to put in two if statements that check
for 255 and if it exists, change it to -1. This works for us:

In sedit.c search for:

 * Copy a -1 terminated (in the type field) shop_buy_data
 * array list.
 */
void copy_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist)

{
  int num_items, i;

  if (*tlist)
    free_type_list(tlist);

  /*
   * Count number of entries.
   */
  for (i = 0; BUY_TYPE(flist[i]) != -1; i++)

AND ADD:

  {    if (BUY_TYPE(flist[i]) == 255)
         {BUY_TYPE(flist[i]) = -1;
       i--;}

AND LOWER DOWN SEARCH FOR:


       * Save the rates.
       */
      fprintf(shop_file, "-1\n%1.2f\n%1.2f\n", S_BUYPROFIT(shop),
S_SELLPROFIT(shop));
      /*
       * Save the buy types and namelists.
       */
      j = -1;
      do {
       j++;

AND ADD:

      if (S_BUYTYPE(shop, j) == 255)
          {S_BUYTYPE(shop, j) = -1;
        i--;}

Hope this works. Any questions, just ask.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST