Example #1
0
// Added by SinaC 2003 for  Circle style
void load_room_circle( FILE *fp ) {
  ROOM_INDEX_DATA *pRoomIndex;

  log_stringf(" ROOMS");

  if ( area_last == NULL ) {
    bug( "Load_room_circle: no #AREA seen yet.");
    exit( 1 );
  }

  for ( ; ; ) {
    int vnum;
    char letter;
    int door;
    int iHash;
    char *ln;
    int x1, x2, x3, x4, x5, x6;

    letter				= fread_letter( fp );
    if ( letter != '#' ) {
      bug( "Load_room_circle: # not found.");
      exit( 1 );
    }

    vnum				= fread_number( fp );
    if ( vnum == 0 )
      break;

    fBootDb = FALSE;
    if ( get_room_index( vnum ) != NULL ) {
      bug( "Load_room_circle: vnum %d duplicated.", vnum );
      exit( 1 );
    }
    fBootDb = TRUE;

    //    pRoomIndex			= (ROOM_INDEX_DATA *) alloc_perm( sizeof(*pRoomIndex) );
    pRoomIndex = new_room_index();
    pRoomIndex->guild		= 0; /* Not a guild */
    pRoomIndex->owner		= str_dup("");
    pRoomIndex->people		= NULL;
    pRoomIndex->contents		= NULL;
    pRoomIndex->extra_descr		= NULL;
    pRoomIndex->area		= area_last;
    pRoomIndex->vnum		= vnum;
    pRoomIndex->name		= fread_string( fp );
    pRoomIndex->description		= fread_string( fp );
    /* Area number */		  fread_number( fp );

    pRoomIndex->bstat(flags)		= fread_flag_circle(fp);
    pRoomIndex->bstat(sector)		= fread_number(fp);
    pRoomIndex->bstat(maxsize)		= SIZE_NOSIZE;

    pRoomIndex->bstat(light)		= 0;
    for ( door = 0; door < MAX_DIR; door++ ) // Modified by SinaC 2003
      pRoomIndex->exit[door] = NULL;

    // Modified by SinaC 2003
    /* defaults */
    pRoomIndex->bstat(healrate) = 100;
    pRoomIndex->bstat(manarate) = 100;
    // Added by SinaC 2003 for mental user
    pRoomIndex->bstat(psprate) = 100;

    for ( ; ; ) {
      EXIT_DATA *pexit;
      int locks;
      EXTRA_DESCR_DATA *ed;
    
      letter = fread_letter( fp );

      if ( letter == 'S' )
	break;
	    
      switch ( letter ) {
      case 'D' : 
	door = fread_number( fp );
	if ( door < 0 || door >= MAX_DIR ) { // Modified by SinaC 2003
	  bug( "Load_room_circle: vnum %d has bad door number.", vnum );
	  exit( 1 );
	}

	if ( door == DIR_SPECIAL )
	  log_stringf("DIR_SPECIAL found for room vnum: %d.", vnum );

	//	pexit			= (EXIT_DATA *) alloc_perm( sizeof(*pexit) );
	pexit = new_exit();
	pexit->description	= fread_string( fp );
	pexit->keyword		= fread_string( fp );
	pexit->exit_info	= 0;
	pexit->rs_flags         = 0;                    /* OLC */
	locks			= fread_number(fp);
	pexit->key		= fread_number(fp);
	pexit->u1.vnum		= fread_number(fp);
	pexit->orig_door	= door;			/* OLC */

	switch ( locks ) {
	case 1: pexit->exit_info = pexit->rs_flags = EX_ISDOOR; break;
	case 2: pexit->exit_info = pexit->rs_flags = EX_ISDOOR | EX_PICKPROOF; break;
	default: pexit->exit_info = pexit->rs_flags = locks;
	  break;
	}

	convert_exit_circle(pexit);
	// SinaC 2003
	if ( IS_SET( pexit->exit_info, EX_CLIMB ) )
	  log_stringf("Room [%d], exit [%d] has CLIMB flag.",
		      vnum, door );

	pRoomIndex->exit[door]	= pexit;
	pRoomIndex->old_exit[door] = pexit;
	break;

      case 'E' :
	//	ed			= (EXTRA_DESCR_DATA *) alloc_perm( sizeof(*ed) );
	ed = new_extra_descr();
	ed->keyword		= fread_string( fp );
	ed->description		= fread_string( fp );
	ed->next		= pRoomIndex->extra_descr;
	pRoomIndex->extra_descr	= ed;
	break;

      default :	    
	bug( "Load_room_circle: vnum %d has unknown flag.", vnum );
	exit( 1 );
      }
    }

    while (1) {
      letter = fread_letter( fp );
      if ( letter == 'T' ) { // Script
	int scriptVnum = fread_number( fp );
	char buf[MAX_STRING_LENGTH];
	sprintf( buf, "room%d", scriptVnum );
	pRoomIndex->program = hash_get_prog(buf);
	if (!pRoomIndex->program)
	  bug("Can't find program for room vnum %d.", pRoomIndex->vnum);
	else {
	  if ( get_root_class( pRoomIndex->program ) != default_room_class ) {
	    bug("program for mob vnum %d is not a room program.", pRoomIndex->vnum);
	    pRoomIndex->program = NULL;
	  }
	  else
	    if ( pRoomIndex->program->isAbstract )
	      bug("program for room vnum %d is an ABSTRACT class.", pRoomIndex->vnum );
	}
      }
      else {
	ungetc(letter,fp);
	break;
      }
    }

    convert_room_circle(pRoomIndex);

    iHash			= vnum % MAX_KEY_HASH;
    pRoomIndex->next	= room_index_hash[iHash];
    room_index_hash[iHash]	= pRoomIndex;
    top_vnum_room = top_vnum_room < vnum ? vnum : top_vnum_room; /* OLC */
    assign_area_vnum( vnum );                                    /* OLC */
  }

  return;
}
Example #2
0
// Added by SinaC 2003 for  Circle style
void load_mob_circle( FILE *fp ) {
  MOB_INDEX_DATA *pMobIndex;
 
  log_stringf(" MOBILES");

  if ( !area_last ) {   /* OLC */
    bug( "Load_mob_circle: no #AREA seen yet.");
    exit( 1 );
  }

  for ( ; ; ) {
    int vnum;
    char letter;
    int iHash;
 
    letter                          = fread_letter( fp );
    if ( letter != '#' ) {
      bug( "Load_mob_circle: # not found.");
      exit( 1 );
    }
 
    vnum                            = fread_number( fp );
    if ( vnum == 0 )
      break;
 
    fBootDb = FALSE;
    if ( get_mob_index( vnum ) != NULL ) {
      bug( "Load_mob_circle: vnum %d duplicated.", vnum );
      exit( 1 );
    }
    fBootDb = TRUE;
 
    //    pMobIndex                       = (MOB_INDEX_DATA*) alloc_perm( sizeof(*pMobIndex) );
    pMobIndex = new_mob_index();
    pMobIndex->vnum                 = vnum;

    pMobIndex->area                 = area_last;               /* OLC */
    pMobIndex->new_format		= TRUE;
    newmobs++;
    pMobIndex->player_name          = fread_string( fp );
    pMobIndex->short_descr          = fread_string( fp );
    pMobIndex->long_descr           = fread_string_upper( fp );
    pMobIndex->description          = fread_string_upper( fp );

    // Added by SinaC 2003
    pMobIndex->classes              = 0;

    pMobIndex->act                  = fread_flag_circle( fp );
    pMobIndex->affected_by          = fread_flag_circle( fp );
    // Added by SinaC 2003
    pMobIndex->affected2_by          = 0;

    pMobIndex->pShop                = NULL;
    // Added by SinaC 2003
    pMobIndex->align.etho           = 0;
    pMobIndex->align.alignment       = fread_number( fp );

    letter = fread_letter( fp ); // mobile type S or E

    pMobIndex->group                = 0;

    pMobIndex->level                = fread_number( fp );

    // Added by SinaC 2003
    if ( pMobIndex->level < pMobIndex->area->low_range )
      pMobIndex->area->low_range = pMobIndex->level;
    if ( pMobIndex->level > pMobIndex->area->high_range )
      pMobIndex->area->high_range = pMobIndex->level;


           fread_number( fp );   // thac0  not used
    pMobIndex->ac[AC_PIERCE] = fread_number( fp ); // ac
    pMobIndex->ac[AC_BASH]   = pMobIndex->ac[AC_PIERCE];
    pMobIndex->ac[AC_SLASH]  = pMobIndex->ac[AC_PIERCE];
    pMobIndex->ac[AC_EXOTIC] = pMobIndex->ac[AC_PIERCE];

    /* read hit dice */
    pMobIndex->hit[DICE_NUMBER]     = fread_number( fp );  
    /* 'd'          */                fread_letter( fp ); 
    pMobIndex->hit[DICE_TYPE]       = fread_number( fp );
    /* '+'          */                fread_letter( fp );   
    pMobIndex->hit[DICE_BONUS]      = fread_number( fp ); 

    pMobIndex->mana[DICE_NUMBER]= 0;
    pMobIndex->mana[DICE_TYPE]	= 0;
    pMobIndex->mana[DICE_BONUS]	= 0;

    pMobIndex->psp[DICE_NUMBER]	= 0;
    pMobIndex->psp[DICE_TYPE]	= 0;
    pMobIndex->psp[DICE_BONUS]	= 0;

    /* read damage dice */
    pMobIndex->damage[DICE_NUMBER]	= fread_number( fp );
    fread_letter( fp );
    pMobIndex->damage[DICE_TYPE]	= fread_number( fp );
    fread_letter( fp );
    pMobIndex->damage[DICE_BONUS]	= fread_number( fp );

    //pMobIndex->wealth		= fread_number( fp ) * 100;  *100 was not needed
    pMobIndex->wealth		= fread_number( fp );
          fread_number(fp);  // Xp not used

    pMobIndex->start_pos		= fread_number(fp);
    pMobIndex->default_pos		= fread_number(fp);
    pMobIndex->sex			= fread_number(fp);
    
    if ( letter != 'S' && letter != 'E' ) {
      bug("Invalid letter (%c) for mob (%d), valid letter are S or E", letter, pMobIndex->vnum );
      exit(-1);
    }

    pMobIndex->race = 0;
    pMobIndex->hitroll = 0;
    pMobIndex->res_flags = 0;
    pMobIndex->imm_flags = 0;
    pMobIndex->vuln_flags = 0;
    if ( letter == 'E' ) { // complex mob
      while(1) {
	char *ln = fread_line( fp );
	if ( ln[0] == 'E' )
	  break;
      }
    }

    while(1) {
      letter = fread_letter( fp );
      if ( letter == 'T' ) { // Script
	int scriptVnum = fread_number( fp );
	char buf[MAX_STRING_LENGTH];
	sprintf( buf, "mob%d", vnum );
	pMobIndex->program = hash_get_prog(buf);
	if (!pMobIndex->program)
	  bug("Can't find program for mob vnum %d.", pMobIndex->vnum);
	else {
	  if ( get_root_class( pMobIndex->program ) != default_mob_class ) {
	    bug("program for mob vnum %d is not a mob program.", pMobIndex->vnum);
	    pMobIndex->program = NULL;
	  }
	  else
	    if ( pMobIndex->program->isAbstract )
	      bug("program for mob vnum %d is an ABSTRACT class.", pMobIndex->vnum );
	}
      }
      else {
	ungetc(letter,fp);
	break;
      }
    }

    convert_mob_circle( pMobIndex );

    iHash                   = vnum % MAX_KEY_HASH;
    pMobIndex->next         = mob_index_hash[iHash];
    mob_index_hash[iHash]   = pMobIndex;
    top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob;  /* OLC */
    assign_area_vnum( vnum );                                  /* OLC */
    kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++;
  }
 
  return;
}
Example #3
0
/*
 * Snarf an obj section.  old style 
 */
void load_obj_circle( FILE *fp ) {
  OBJ_INDEX_DATA *pObjIndex;
  char *word;

  log_stringf(" OBJECTS");

  if ( !area_last ) {  /* OLC */
    bug( "Load_obj_circle: no #AREA seen yet.");
    exit( 1 );
  }

  for ( ; ; ) {
    int vnum;
    char letter;
    int iHash;
    int x1, x2, x3, x4, x5, x6;

    letter				= fread_letter( fp );
    if ( letter != '#' ) {
      bug( "Load_obj_circle: # not found.");
      exit( 1 );
    }

    vnum				= fread_number( fp );
    if ( vnum == 0 )
      break;

    fBootDb = FALSE;
    if ( get_obj_index( vnum ) != NULL ) {
      bug( "Load_obj_circle: vnum %d duplicated.", vnum );
      exit( 1 );
    }
    fBootDb = TRUE;

    pObjIndex = new_obj_index();
    pObjIndex->vnum			= vnum;
    pObjIndex->area                 = area_last;            /* OLC */
    pObjIndex->new_format		= FALSE;
    pObjIndex->reset_num	 	= 0;
    newobjs++;
    pObjIndex->name			= fread_string( fp );
    pObjIndex->short_descr		= fread_string_lower( fp );
    pObjIndex->description		= fread_string_upper( fp );
    fread_string( fp ); // unused:  action desc

    pObjIndex->material = 0;

    pObjIndex->item_type		= fread_number( fp );
    pObjIndex->extra_flags		= fread_flag_circle( fp );
    pObjIndex->wear_flags		= fread_flag_circle( fp );
    fread_flag_circle(fp); // unused ?

    pObjIndex->size = SIZE_NOSIZE;
    
    pObjIndex->value[0]		= fread_number(fp);
    pObjIndex->value[1]		= fread_number(fp);
    pObjIndex->value[2]		= fread_number(fp);
    pObjIndex->value[3]		= fread_number(fp);

    pObjIndex->weight		= UMAX( 1, fread_number( fp ) );
    pObjIndex->cost			= fread_number( fp );
    fread_number( fp ); // unused:  rent/day
    fread_number(fp); // unused ?

    pObjIndex->condition = 100;
    pObjIndex->level = 1;

    for ( ; ; ) {
      letter = fread_letter( fp );

      if ( letter == 'A' ) {
	AFFECT_DATA *paf;
	
	paf = new_affect();
	createaff(*paf,-1,20,-1,0,AFFECT_INHERENT);
	addaff2(*paf,AFTO_CHAR,fread_number( fp ),AFOP_ADD,fread_number( fp ));
	//paf->where              = AFTO_CHAR;
	//paf->op                 = AFOP_ADD;
	//paf->type		= -1;
	//paf->level		= 20; /* RT temp fix */
	//paf->duration		= -1;
	//paf->location         = fread_number( fp );
	//paf->modifier		= fread_number( fp );

	convert_af_circle( paf );
	
	paf->next		= pObjIndex->affected;
	pObjIndex->affected	= paf;
      }
      else if ( letter == 'E' )	{
	EXTRA_DESCR_DATA *ed;
	
	//	ed			= (EXTRA_DESCR_DATA *) alloc_perm( sizeof(*ed) );
	ed = new_extra_descr();
	ed->keyword		= fread_string( fp );
	ed->description		= fread_string( fp );
	ed->next		= pObjIndex->extra_descr;
	pObjIndex->extra_descr	= ed;
      }
      else if ( letter == 'T' ) { // script
	int scriptVnum = fread_number( fp );
	char buf[MAX_STRING_LENGTH];
	sprintf( buf, "obj%d", scriptVnum );
	pObjIndex->program = hash_get_prog(buf);
	if (!pObjIndex->program)
	  bug("Can't find program for obj vnum %d.", pObjIndex->vnum);
	else {
	  if ( get_root_class( pObjIndex->program ) != default_obj_class ) {
	    bug("program for obj vnum %d is not a mob program." ,pObjIndex->vnum);
	    pObjIndex->program = NULL;
	  }
	  else
	    if ( pObjIndex->program->isAbstract )
	      bug("program for Obj vnum %d is an ABSTRACT class.", pObjIndex->vnum );
	}
      }
      else {
	ungetc( letter, fp );
	break;
      }
    }

    switch ( pObjIndex->item_type ) {
    case CIRCLE_ITEM_POTION:
    case CIRCLE_ITEM_SCROLL:
      pObjIndex->value[1] = slot_lookup( pObjIndex->value[1] );
      pObjIndex->value[2] = slot_lookup( pObjIndex->value[2] );
      pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] );
      break;
      
    case CIRCLE_ITEM_STAFF:
    case CIRCLE_ITEM_WAND:
      pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] );
      break;
    }

    convert_obj_circle( pObjIndex );

    iHash			= vnum % MAX_KEY_HASH;
    pObjIndex->next		= obj_index_hash[iHash];
    obj_index_hash[iHash]	= pObjIndex;
    top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj;   /* OLC */
    assign_area_vnum( vnum );                                   /* OLC */
  }

  return;
}
Example #4
0
void load_objects(FILE * fp)
{
    OBJ_INDEX_DATA *pObjIndex;

    if (!area_last) {		/* OLC */
	bug("Load_objects: no #AREA seen yet.", 0);
	exit(1);
    }
    for (;;) {
	sh_int vnum;
	char letter;
	int iHash;

	letter = fread_letter(fp);
	if (letter != '#') {
	    bug("Load_objects: # not found.", 0);
	    exit(1);
	}
	vnum = fread_number(fp);
	if (vnum == 0)
	    break;

	fBootDb = FALSE;
	if (get_obj_index(vnum) != NULL) {
	    bug("Load_objects: vnum %d duplicated.", vnum);
	    exit(1);
	}
	fBootDb = TRUE;

	pObjIndex = alloc_perm(sizeof(*pObjIndex));
	pObjIndex->vnum = vnum;
	pObjIndex->area = area_last;	/* OLC */
	pObjIndex->new_format = TRUE;
	pObjIndex->reset_num = 0;
	newobjs++;
	pObjIndex->name = fread_string(fp);
	pObjIndex->short_descr = fread_string(fp);
	pObjIndex->description = fread_string(fp);
	pObjIndex->material = fread_string(fp);

	pObjIndex->item_type = item_lookup(fread_word(fp));
	pObjIndex->extra_flags = fread_flag(fp);
	pObjIndex->wear_flags = fread_flag(fp);
	switch (pObjIndex->item_type) {
	case ITEM_WEAPON:
	    pObjIndex->value[0] = weapon_type(fread_word(fp));
	    pObjIndex->value[1] = fread_number(fp);
	    pObjIndex->value[2] = fread_number(fp);
	    pObjIndex->value[3] = attack_lookup(fread_word(fp));
	    pObjIndex->value[4] = fread_flag(fp);
	    break;
	case ITEM_CONTAINER:
	    pObjIndex->value[0] = fread_number(fp);
	    pObjIndex->value[1] = fread_flag(fp);
	    pObjIndex->value[2] = fread_number(fp);
	    pObjIndex->value[3] = fread_number(fp);
	    pObjIndex->value[4] = fread_number(fp);
	    break;
	case ITEM_DRINK_CON:
	case ITEM_FOUNTAIN:
	    pObjIndex->value[0] = fread_number(fp);
	    pObjIndex->value[1] = fread_number(fp);
	    pObjIndex->value[2] = liq_lookup(fread_word(fp));
	    pObjIndex->value[3] = fread_number(fp);
	    pObjIndex->value[4] = fread_number(fp);
	    break;
	case ITEM_WAND:
	case ITEM_STAFF:
	    pObjIndex->value[0] = fread_number(fp);
	    pObjIndex->value[1] = fread_number(fp);
	    pObjIndex->value[2] = fread_number(fp);
	    pObjIndex->value[3] = skill_lookup(fread_word(fp));
	    pObjIndex->value[4] = fread_number(fp);
	    break;
	case ITEM_POTION:
	case ITEM_PILL:
	case ITEM_SCROLL:
	    pObjIndex->value[0] = fread_number(fp);
	    pObjIndex->value[1] = skill_lookup(fread_word(fp));
	    pObjIndex->value[2] = skill_lookup(fread_word(fp));
	    pObjIndex->value[3] = skill_lookup(fread_word(fp));
	    pObjIndex->value[4] = skill_lookup(fread_word(fp));
	    break;
	default:
	    pObjIndex->value[0] = fread_flag(fp);
	    pObjIndex->value[1] = fread_flag(fp);
	    pObjIndex->value[2] = fread_flag(fp);
	    pObjIndex->value[3] = fread_flag(fp);
	    pObjIndex->value[4] = fread_flag(fp);
	    break;
	}
	pObjIndex->level = fread_number(fp);
	pObjIndex->weight = fread_number(fp);
	pObjIndex->cost = fread_number(fp);

	/* condition */
	letter = fread_letter(fp);
	switch (letter) {
	case ('P'):
	    pObjIndex->condition = 100;
	    break;
	case ('G'):
	    pObjIndex->condition = 90;
	    break;
	case ('A'):
	    pObjIndex->condition = 75;
	    break;
	case ('W'):
	    pObjIndex->condition = 50;
	    break;
	case ('D'):
	    pObjIndex->condition = 25;
	    break;
	case ('B'):
	    pObjIndex->condition = 10;
	    break;
	case ('R'):
	    pObjIndex->condition = 0;
	    break;
	default:
	    pObjIndex->condition = 100;
	    break;
	}

	for (;;) {
	    char letter;

	    letter = fread_letter(fp);

	    if (letter == 'A') {
		AFFECT_DATA *paf;

		paf = alloc_perm(sizeof(*paf));
		paf->where = TO_OBJECT;
		paf->type = -1;
		paf->level = pObjIndex->level;
		paf->duration = -1;
		paf->location = fread_number(fp);
		paf->modifier = fread_number(fp);
		paf->bitvector = 0;
		paf->next = pObjIndex->affected;
		pObjIndex->affected = paf;
		top_affect++;
	    } else if (letter == 'F') {
		AFFECT_DATA *paf;

		paf = alloc_perm(sizeof(*paf));
		letter = fread_letter(fp);
		switch (letter) {
		case 'A':
		    paf->where = TO_AFFECTS;
		    break;
		case 'I':
		    paf->where = TO_IMMUNE;
		    break;
		case 'R':
		    paf->where = TO_RESIST;
		    break;
		case 'V':
		    paf->where = TO_VULN;
		    break;
		default:
		    bug("Load_objects: Bad where on flag set.", 0);
		    exit(1);
		}
		paf->type = -1;
		paf->level = pObjIndex->level;
		paf->duration = -1;
		paf->location = fread_number(fp);
		paf->modifier = fread_number(fp);
		paf->bitvector = fread_flag(fp);
		paf->next = pObjIndex->affected;
		pObjIndex->affected = paf;
		top_affect++;
	    } else if (letter == 'E') {
		EXTRA_DESCR_DATA *ed;

		ed = alloc_perm(sizeof(*ed));
		ed->keyword = fread_string(fp);
		ed->description = fread_string(fp);
		ed->next = pObjIndex->extra_descr;
		pObjIndex->extra_descr = ed;
		top_ed++;
	    } else {
		ungetc(letter, fp);
		break;
	    }
	}

	iHash = vnum % MAX_KEY_HASH;
	pObjIndex->next = obj_index_hash[iHash];
	obj_index_hash[iHash] = pObjIndex;
	top_obj_index++;
	top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj;	/* OLC */
	assign_area_vnum(vnum);	/* OLC */
    }

    return;
}
Example #5
0
void load_mobiles(FILE * fp)
{
    MOB_INDEX_DATA *pMobIndex;

    if (!area_last) {		/* OLC */
	bug("Load_mobiles: no #AREA seen yet.", 0);
	exit(1);
    }
    for (;;) {
	sh_int vnum;
	char letter;
	int iHash;

	letter = fread_letter(fp);
	if (letter != '#') {
	    bug("Load_mobiles: # not found.", 0);
	    exit(1);
	}
	vnum = fread_number(fp);
	if (vnum == 0)
	    break;

	fBootDb = FALSE;
	if (get_mob_index(vnum) != NULL) {
	    bug("Load_mobiles: vnum %d duplicated.", vnum);
	    exit(1);
	}
	fBootDb = TRUE;

	pMobIndex = alloc_perm(sizeof(*pMobIndex));
	pMobIndex->vnum = vnum;
	pMobIndex->area = area_last;	/* OLC */
	pMobIndex->new_format = TRUE;
	newmobs++;
	pMobIndex->player_name = fread_string(fp);
	pMobIndex->short_descr = fread_string(fp);
	pMobIndex->long_descr = fread_string(fp);
	
	pMobIndex->long_descr_orig = fread_string(fp);
	pMobIndex->description = fread_string(fp);
	pMobIndex->race = race_lookup(fread_string(fp));

	pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]);
	pMobIndex->description[0] = UPPER(pMobIndex->description[0]);

	pMobIndex->act = fread_flag(fp) | ACT_IS_NPC
	    | race_table[pMobIndex->race].act;
	pMobIndex->affected_by = fread_flag(fp)
	    | race_table[pMobIndex->race].aff;
	pMobIndex->pShop = NULL;
	pMobIndex->alignment = fread_number(fp);
	pMobIndex->group = fread_number(fp);

	pMobIndex->level = fread_number(fp);
	pMobIndex->hitroll = fread_number(fp);

	/* read hit dice */
	pMobIndex->hit[DICE_NUMBER] = fread_number(fp);
	/* 'd'          */ fread_letter(fp);
	pMobIndex->hit[DICE_TYPE] = fread_number(fp);
	/* '+'          */ fread_letter(fp);
	pMobIndex->hit[DICE_BONUS] = fread_number(fp);

	/* read mana dice */
	pMobIndex->mana[DICE_NUMBER] = fread_number(fp);
	fread_letter(fp);
	pMobIndex->mana[DICE_TYPE] = fread_number(fp);
	fread_letter(fp);
	pMobIndex->mana[DICE_BONUS] = fread_number(fp);

	/* read damage dice */
	pMobIndex->damage[DICE_NUMBER] = fread_number(fp);
	fread_letter(fp);
	pMobIndex->damage[DICE_TYPE] = fread_number(fp);
	fread_letter(fp);
	pMobIndex->damage[DICE_BONUS] = fread_number(fp);
	pMobIndex->dam_type = attack_lookup(fread_word(fp));

	/* read armor class */
	pMobIndex->ac[AC_PIERCE] = fread_number(fp) * 10;
	pMobIndex->ac[AC_BASH] = fread_number(fp) * 10;
	pMobIndex->ac[AC_SLASH] = fread_number(fp) * 10;
	pMobIndex->ac[AC_EXOTIC] = fread_number(fp) * 10;

	/* read flags and add in data from the race table */
	pMobIndex->off_flags = fread_flag(fp)
	    | race_table[pMobIndex->race].off;
	pMobIndex->imm_flags = fread_flag(fp)
	    | race_table[pMobIndex->race].imm;
	pMobIndex->res_flags = fread_flag(fp)
	    | race_table[pMobIndex->race].res;
	pMobIndex->vuln_flags = fread_flag(fp)
	    | race_table[pMobIndex->race].vuln;

	/* vital statistics */
	pMobIndex->start_pos = position_lookup(fread_word(fp));
	pMobIndex->default_pos = position_lookup(fread_word(fp));
	pMobIndex->sex = sex_lookup(fread_word(fp));

	pMobIndex->wealth = fread_number(fp);

	pMobIndex->form = fread_flag(fp)
	    | race_table[pMobIndex->race].form;
	pMobIndex->parts = fread_flag(fp)
	    | race_table[pMobIndex->race].parts;
	/* size */
	pMobIndex->size = size_lookup(fread_word(fp));
	pMobIndex->material = str_dup(fread_word(fp));

	for (;;) {
	    letter = fread_letter(fp);

	    if (letter == 'F') {
		char *word;
		long vector;

		word = fread_word(fp);
		vector = fread_flag(fp);

		if (!str_prefix(word, "act"))
		    REMOVE_BIT(pMobIndex->act, vector);
		else if (!str_prefix(word, "aff"))
		    REMOVE_BIT(pMobIndex->affected_by, vector);
		else if (!str_prefix(word, "off"))
		    REMOVE_BIT(pMobIndex->off_flags, vector);
		else if (!str_prefix(word, "imm"))
		    REMOVE_BIT(pMobIndex->imm_flags, vector);
		else if (!str_prefix(word, "res"))
		    REMOVE_BIT(pMobIndex->res_flags, vector);
		else if (!str_prefix(word, "vul"))
		    REMOVE_BIT(pMobIndex->vuln_flags, vector);
		else if (!str_prefix(word, "for"))
		    REMOVE_BIT(pMobIndex->form, vector);
		else if (!str_prefix(word, "par"))
		    REMOVE_BIT(pMobIndex->parts, vector);
		else {
		    bug("Flag remove: flag not found.", 0);
		    exit(1);
		}
	    } else if (letter == 'M') {
		MPROG_LIST *pMprog;
		char *word;
		int trigger = 0;

		pMprog = alloc_perm(sizeof(*pMprog));
		word = fread_word(fp);
		if (!(trigger = flag_lookup(word, mprog_flags))) {
		    bug("MOBprogs: invalid trigger.", 0);
		    exit(1);
		}
		SET_BIT(pMobIndex->mprog_flags, trigger);
		pMprog->trig_type = trigger;
		pMprog->vnum = fread_number(fp);
		pMprog->trig_phrase = fread_string(fp);
		pMprog->next = pMobIndex->mprogs;
		pMobIndex->mprogs = pMprog;
	    } else {
		ungetc(letter, fp);
		break;
	    }
	}

	iHash = vnum % MAX_KEY_HASH;
	pMobIndex->next = mob_index_hash[iHash];
	mob_index_hash[iHash] = pMobIndex;
	top_mob_index++;
	top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob;	/* OLC */
	assign_area_vnum(vnum);	/* OLC */
	kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL - 1)].number++;
    }

    return;
}
/*
 * Snarf an obj section. new style
 */
void load_objects ( FILE *fp )
{
	ItemData *pObjIndex;

	if ( !area_last ) { /* OLC */
		log_hd ( LOG_ERROR, "Load_objects: no #AREA seen yet." );
		exit ( 1 );
	}

	while ( true ) {
		int vnum;
		char letter;
		int iHash;

		letter                          = fread_letter ( fp );
		if ( letter != '#' ) {
			log_hd ( LOG_ERROR, "Load_objects: # not found." );
			exit ( 1 );
		}

		vnum                            = fread_number ( fp );
		if ( vnum == 0 )
		{ break; }

		fBootDb = FALSE;
		if ( get_obj_index ( vnum ) != NULL ) {
			log_hd ( LOG_ERROR, Format ( "Load_objects: vnum %d duplicated.", vnum ) );
			exit ( 1 );
		}
		fBootDb = TRUE;

		ALLOC_DATA ( pObjIndex, ItemData, 1 );

		pObjIndex->vnum                 = vnum;
		pObjIndex->area                 = area_last;            /* OLC */
		pObjIndex->new_format           = TRUE;
		pObjIndex->reset_num		= 0;
		newobjs++;
		pObjIndex->name                 = fread_string ( fp );
		pObjIndex->short_descr          = fread_string ( fp );
		pObjIndex->description          = fread_string ( fp );

		CHECK_POS ( pObjIndex->item_type, item_lookup ( fread_word ( fp ) ), "item_type" );
		pObjIndex->extra_flags          = fread_flag ( fp );
		pObjIndex->wear_flags           = fread_flag ( fp );
		pObjIndex->material_flags       = fread_flag ( fp );
		switch ( pObjIndex->item_type ) {
			case ITEM_WEAPON:
				pObjIndex->value[0]		= weapon_type ( fread_word ( fp ) );
				pObjIndex->value[1]		= fread_number ( fp );
				pObjIndex->value[2]		= fread_number ( fp );
				pObjIndex->value[3]		= attack_lookup ( fread_word ( fp ) );
				pObjIndex->value[4]		= fread_flag ( fp );
				break;
			case ITEM_CONTAINER:
				pObjIndex->value[0]		= fread_number ( fp );
				pObjIndex->value[1]		= fread_flag ( fp );
				pObjIndex->value[2]		= fread_number ( fp );
				pObjIndex->value[3]		= fread_number ( fp );
				pObjIndex->value[4]		= fread_number ( fp );
				break;
			case ITEM_DRINK_CON:
			case ITEM_FOUNTAIN:
				pObjIndex->value[0]         = fread_number ( fp );
				pObjIndex->value[1]         = fread_number ( fp );
				CHECK_POS ( pObjIndex->value[2], liq_lookup ( fread_word ( fp ) ), "liq_lookup" );
				pObjIndex->value[3]         = fread_number ( fp );
				pObjIndex->value[4]         = fread_number ( fp );
				break;
			case ITEM_WAND:
			case ITEM_STAFF:
				pObjIndex->value[0]		= fread_number ( fp );
				pObjIndex->value[1]		= fread_number ( fp );
				pObjIndex->value[2]		= fread_number ( fp );
				pObjIndex->value[3]		= skill_lookup ( fread_word ( fp ) );
				pObjIndex->value[4]		= fread_number ( fp );
				break;
			case ITEM_POTION:
			case ITEM_PILL:
			case ITEM_SCROLL:
				pObjIndex->value[0]		= fread_number ( fp );
				pObjIndex->value[1]		= skill_lookup ( fread_word ( fp ) );
				pObjIndex->value[2]		= skill_lookup ( fread_word ( fp ) );
				pObjIndex->value[3]		= skill_lookup ( fread_word ( fp ) );
				pObjIndex->value[4]		= skill_lookup ( fread_word ( fp ) );
				break;
			default:
				pObjIndex->value[0]             = fread_flag ( fp );
				pObjIndex->value[1]             = fread_flag ( fp );
				pObjIndex->value[2]             = fread_flag ( fp );
				pObjIndex->value[3]             = fread_flag ( fp );
				pObjIndex->value[4]		    = fread_flag ( fp );
				break;
		}
		pObjIndex->level		= fread_number ( fp );
		pObjIndex->weight               = fread_number ( fp );
		pObjIndex->cost                 = fread_number ( fp );

		/* condition */
		letter 				= fread_letter ( fp );
		switch ( letter ) {
			case ( 'P' ) :
				pObjIndex->condition = 100;
				break;
			case ( 'G' ) :
				pObjIndex->condition =  90;
				break;
			case ( 'A' ) :
				pObjIndex->condition =  75;
				break;
			case ( 'W' ) :
				pObjIndex->condition =  50;
				break;
			case ( 'D' ) :
				pObjIndex->condition =  25;
				break;
			case ( 'B' ) :
				pObjIndex->condition =  10;
				break;
			case ( 'R' ) :
				pObjIndex->condition =   0;
				break;
			default:
				pObjIndex->condition = 100;
				break;
		}

		while ( true ) {
			char letter;

			letter = fread_letter ( fp );

			if ( letter == 'A' ) {
				Affect *paf;

				ALLOC_DATA ( paf, Affect, 1 );

				paf->where		= TO_OBJECT;
				paf->type               = -1;
				paf->level              = pObjIndex->level;
				paf->duration           = -1;
				paf->location           = fread_number ( fp );
				paf->modifier           = fread_number ( fp );
				paf->bitvector          = 0;
				paf->next               = pObjIndex->affected;
				pObjIndex->affected     = paf;
				top_affect++;
			}

			else if ( letter == 'F' ) {
				Affect *paf;

				ALLOC_DATA ( paf, Affect, 1 );

				letter 			= fread_letter ( fp );
				switch ( letter ) {
					case 'A':
						paf->where          = TO_AFFECTS;
						break;
					case 'I':
						paf->where		= TO_IMMUNE;
						break;
					case 'R':
						paf->where		= TO_RESIST;
						break;
					case 'V':
						paf->where		= TO_VULN;
						break;
					default:
						log_hd ( LOG_ERROR, "Load_objects: Bad where on flag set." );
						exit ( 1 );
				}
				paf->type               = -1;
				paf->level              = pObjIndex->level;
				paf->duration           = -1;
				paf->location           = fread_number ( fp );
				paf->modifier           = fread_number ( fp );
				paf->bitvector          = fread_flag ( fp );
				paf->next               = pObjIndex->affected;
				pObjIndex->affected     = paf;
				top_affect++;
			}

			else if ( letter == 'E' ) {
				DescriptionData *ed;

				ALLOC_DATA ( ed, DescriptionData, 1 );

				ed->keyword             = fread_string ( fp );
				ed->description         = fread_string ( fp );
				ed->next                = pObjIndex->extra_descr;
				pObjIndex->extra_descr  = ed;
				top_ed++;
			} else if ( letter == 'R' ) {
				pObjIndex->requirements[SIZ_REQ]	= fread_number ( fp );
				pObjIndex->requirements[STR_REQ]	= fread_number ( fp );
				pObjIndex->requirements[DEX_REQ]	= fread_number ( fp );
				pObjIndex->requirements[CON_REQ]	= fread_number ( fp );
				pObjIndex->requirements[INT_REQ]	= fread_number ( fp );
				pObjIndex->requirements[WIS_REQ]	= fread_number ( fp );
			} else if ( letter == 'L' ) {
				pObjIndex->repop_percent = fread_number ( fp );
			} else {
				ungetc ( letter, fp );
				break;
			}
		}

		iHash                   = vnum % MAX_KEY_HASH;
		pObjIndex->next         = obj_index_hash[iHash];
		obj_index_hash[iHash]   = pObjIndex;
		top_obj_index++;
		top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj;   /* OLC */
		assign_area_vnum ( vnum );                                  /* OLC */
	}

	return;
}