CODE: Wierd Oasis Bug

From: Mike Donais. (donais@server.uwindsor.ca)
Date: 06/28/96


Well I realize lots of people are posting about oasis bugs, since I haven't
seen this one I suppose I will ask about it.

I have really wierd errors occuring from time to time on the mud.
Often it is zon file changes.  The actual .zon save files are somehow
changing by themselves.  Like a shopkeeper normally loads to room 'x'
then all of a sudden a new mob (that was JUST built) is loaded into his
place.  And I look at the .zon files and sure enough the new mobs vnum is 
there and the file isn't corrupt or anything.  This problem happens even
before save_to_disk it happens immediatly.  Here is a specific example:

medit creating new mob 8301, is causing the zedit to point to 8301 instead
of 8302 like it should be.

was load mob 8302, now its load mob 8301 in 2 rooms.

Zone file 83 before problem occured:
...lots of lines...
M 0 8302 2 8302

Presently mob 8302 is loading in room 8302. It works fine.

Now we create a mob 8301 (since mob 8301 did not exist before).
We then zedit to make mob 8301 load up in room 8301.

[at this point the bug manifests itself, room 8302 is changed by itself]

we then do zedit save 83, medit save 83. [note the bug came before saving]

here is the new 83.zon after the problem occured:
D 0 8301 0 1      /* this new line is added */
M 0 8301 2 8301   /* this new line is added */
M 0 8301 2 8302   /* This line replaced the old load mob line in the .zon */
===================

I am pretty sure the problem is in zedit.c save_internally as opposed to
save_to_file since the problem manifests before it is saved to file.
[I will include the zedit_save_internally function at the bottom. 

Anyone with a clue about this please help.

Note that the bugs are not consistent, they happen at unpredictable times
and do unpredictable things, but normally the zon file gets edited.
-- 
Mike Donais. (BOFH) (donais@uwindsor.ca)
SOCR: Student Operated Computing Resources (http://supernova.uwindsor.ca)
--
If yours is different or you can see a error plz tell me:

void zedit_save_internally(struct descriptor_data *d)
{ int subcmd = 0, cmd_room = -2, room_num;

  room_num = real_room(OLC_NUM(d));

  /*. Zap all entried in zone_table that relate to this room .*/
  while(ZCMD.command != 'S')
  { switch(ZCMD.command)
    { case 'M':
      case 'O':
        cmd_room = ZCMD.arg3;
        break;
      case 'D':
      case 'X':
      case 'R':
        cmd_room = ZCMD.arg1;
        break;
      default:
        break;
    }
    if(cmd_room == room_num)
      remove_cmd_from_list(&(zone_table[OLC_ZNUM(d)].cmd), subcmd);
    else
      subcmd++;
  }

  /*. Now add all the entries in the players descriptor list .*/
  subcmd = 0;
  while(MYCMD.command != 'S')
  { add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd);
    subcmd++;
  }

  /*. Finally, if zone headers have been changed, copy over .*/
  if (OLC_ZONE(d)->number)
  { free(zone_table[OLC_ZNUM(d)].name);
    zone_table[OLC_ZNUM(d)].name        = str_dup(OLC_ZONE(d)->name);
    zone_table[OLC_ZNUM(d)].top         = OLC_ZONE(d)->top;
    zone_table[OLC_ZNUM(d)].reset_mode  = OLC_ZONE(d)->reset_mode;
    zone_table[OLC_ZNUM(d)].lifespan    = OLC_ZONE(d)->lifespan;
  }
  olc_add_to_save_list(zone_table[OLC_ZNUM(d)].number, OLC_SAVE_ZONE);
}



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