mana_gain() regening in leaps and bounds?

From: David Cole (tiznor@softhome.net)
Date: 04/28/02


Hello,

I seem to be creating more of a mess then creating something better. I've
recently redone the mana_gain, hit_gain etc etc to something that will
update a few hitpoints a time, time being every three seconds. Problem is
though, instead of updating ever 3 second, it updates every second and in
leeps and bounds: below is my mana_gain() and the call I have in hear_beat
in comm.c, also how I call the the three function is PointUpdated which I
have posted below as well. Am I calling something incorrectly? Or have I
just done something wrong minor or huge?

void PointUpdate(void)
{
  struct char_data *i, *next_char;

  for (i = character_list; i; i = next_char) {
    next_char = i->next;

   if (GET_HIT(i) != GET_MAX_HIT(i))
        GET_HIT(i) = (GET_HIT(i) + hit_gain(i));
   if (GET_MANA(i) != GET_MAX_MANA(i))
        GET_MANA(i) = (GET_MANA(i) + mana_gain(i));
   if (GET_MOVE(i) != GET_MAX_MOVE(i))
        GET_MOVE(i) = (GET_MOVE(i) + move_gain(i));
  }
}

int mana_gain(struct char_data * ch)
{
  int gain;
  gain = 0;

  switch (GET_POS(ch)) {
  case POS_DEAD:
 gain = 0;
 break;
  case POS_MORTALLYW:
 gain = 0;
 break;
  case POS_INCAP:
 gain = 0;
 break;
  case POS_STUNNED:
 gain = 0;
 break;
  case POS_SLEEPING:
 gain = 4;
 break;
  case POS_RECLINING:
 gain = 3;
 break;
  case POS_RESTING:
 gain = 3;
 break;
  case POS_SITTING:
 gain = 2;
 break;
  case POS_FIGHTING:
 gain = 1;
 break;
  case POS_STANDING:
 gain = 1;
 break;
  }
  if ((GET_COND(ch, FULL) == 0) || (GET_COND(ch, THIRST) == 0))
    gain = 1;

  if (AFF_FLAGGED(ch, AFF_POISON))
    gain = 1;

  return (gain);
}

in comm.c:
   if (!(pulse % (5 * PASSES_PER_SEC)))
    UpdateRacialAffs();
    PointUpdate();

Any help would be greatly appreciated.

Thanks,
Dave

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT