pets.c

./mudd/src/pets.c · 731 B

From the archive emlen.tar.gz

Download the archive   « Back to the archive contents

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mud.h"

void 
place_pets (CHAR_DATA * ch)
{
  int k;
  MOB_PROTOTYPE *mid;
  CHAR_DATA *mob;
  if (IS_MOB (ch))
    return;
  for (k = 0; k < 20; k++)
    {
      if (ch->pcdata->pet_temp[k] != 0)
	{
	  if ((mid = get_mob_index (ch->pcdata->pet_temp[k])) == NULL)
	    {
	      ch->pcdata->pet_temp[k] = 0;
	      continue;
	    }
	  mob = create_mobile (mid);
	  char_to_room (mob, ch->in_room);
	  ch->pcdata->number_pets++;
	  mob->hit = ch->pcdata->pet_hps[k];
	  mob->move = ch->pcdata->pet_move[k];
	  SET_BIT (mob->aff[HURT], CHARM);
	  SET_BIT (mob->act, ACT_PET);
	  add_follower (mob, ch);
	}
    }
  return;
}

Site Stats

Snippets: 1791
Codebases: 571