search_rent_files

From: Matt Read (mjr@doc.ic.ac.uk)
Date: 09/10/94


Ok, here it is... the function needs to be called from somewhere in db.c, I put
it just after the line index_boot(DB_BOOT_OBJ); with a relevant log output.
The only other things you need to add are 2 lines in objsave.c, one where it
is extract a chars eq as he rents and another where he's entering game from
rent.
I think that's about everything...

		Free.

______________________________________________________________________________

void search_rent_files(void)    /* Free '94 for UnknownMud */
{
  struct char_file_u tmp_player;
  char fname[MAX_INPUT_LENGTH];
  struct obj_file_elem tmp_object;
  FILE *pfile, *rfile;
        
/* get a player name from player file */

  if (!(pfile = fopen(PLAYER_FILE, "r")))
    {
      perror("error opening playerfile");
      exit();
    }
  
  while (!(feof(pfile)))
    {
      fread(&tmp_player, sizeof(struct char_file_u), 1, pfile);
      
/* get filename of player's rent file */

      if (!get_filename(tmp_player.name, fname, CRASH_FILE))
	{
	  perror("getting rentfile name for player");
	  exit();
	}
      
      if(!(rfile = fopen(fname, "r")))
	{
	  sprintf(buf, "%s has no rent file.", tmp_player.name);
/*	  log(buf); */
	}
      else

/* scan through objects in rent file, adjusting obj_index */

	{
	  fseek(rfile, sizeof(struct rent_info), 1);
	  while (!(feof(rfile)))
	    {
	      fread(&tmp_object, sizeof(struct obj_file_elem), 1, rfile);
	      obj_index[real_object(tmp_object.item_number)].number++;
	    }
	  fclose(rfile);
	}
    }
  fclose(pfile);
}



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