Re: [mob index problem]

From: Gary Barnett (gbarnett@POLARNET.COM)
Date: 08/08/97


On Friday, August 08, 1997 2:49 AM, Ron Hensley [SMTP:ron@CROSS.DMV.COM]
wrote:
> On Fri, 8 Aug 1997, Snow Man wrote:
<snip>
> > can anyone help me with this error?
<snip>
> >
> > Fri Aug  8 04:37:02 :: Loading mobs and generating index.
> > Format error after mob #-1
> > thanks
>
> Go look in your mob directory. One of your mob files is empty due to an
> OLC crash i would bet. When oasis writes a file to disk, the old one is
> overwritten temporarily, id imagine due to an fopen(file,"w") call.
>
> If the mud crashes before the file is re-written, you end up with an
> empty file. Ive not had this problem in quite some time, but it does
happen.
>
<snip>

Here's a little snippet to mitigate some of the data loss from an olc crash.

Just put this, or a varient of it, in the xxxxx_save_to_disk for each olc
save
routine. Then, when you get a crash just copy xx.wld.bak to xx.wld to restore
it as of the last successful save.

sprintf(buf, "%s/%d.wld", WLD_PREFIX, zone_table[OLC_ZNUM(d)].number);
sprintf(buf2, "%s/%d.wld.bak", WLD_PREFIX, zone_table[OLC_ZNUM(d)].number);
if (remove(buf2 ) == -1 )
   log_info("SYSERR: Error deleting a room .BAK file.");

if (rename(buf, buf2)) {
   log_info("SYSERR: Error renaming a room file to .BAK");
   return;  /* bail if we can't rename. */
}
buf2[0]='\0';

if (!(fp = fopen(buf, "w+")))  {
   log_info("SYSERR: OLC: Cannot open room file!");
   return;
}

--Mallory
I can picture in my mind a world without war, a world without hate.
And I can picture us attacking that world, because they'd never
expect it.     - Jack Handey


     +------------------------------------------------------------+
     | 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/08/00 PST