[NEWBIE][DGEVENTS] Regen snippet problem

From: John Hines (jahweb@grnco.net)
Date: 09/04/99


Hello,
        Having a bit of a problem dealing with dgevents and the regen patch
found on the ftp site. I am getting compiler warnings from the following
that was included as part of regen.c. Code posted below with compiler
output:


EVENTFUNC(points_event)
{
  struct regen_event_obj *regen = (struct regen_event_obj *) event_obj;
  struct char_data *ch;
  int type, gain;
  char logbuf[100];
  /* void points_event(viod *event_obj) ??? */

  ch = regen->ch;
  type = regen->type;

  if (GET_POS(ch) >= POS_STUNNED) {
    /* no help for the dying */

    /*
     * Increment type of points by one.
     * If not at max, reenqueue the event.
     */

    switch (type) {
    case REGEN_HIT:
      GET_HIT(ch) = MIN(GET_HIT(ch) + 1, GET_MAX_HIT(ch));
      if (ch->in_room == NOWHERE)
        return;
      if (GET_POS(ch) <= POS_STUNNED)
        update_pos(ch);
      if (GET_HIT(ch) < GET_MAX_HIT(ch)) {
        /* reenqueue the event */
        gain = hit_gain(ch);
        return (PULSES_PER_MUD_HOUR / (gain ? gain : 1));
      }
      break;


    case REGEN_MANA:
      GET_MANA(ch) = MIN(GET_MANA(ch) + 1, GET_MAX_MANA(ch));
      if (ch->in_room == NOWHERE)
        return;
      if (GET_MANA(ch) < GET_MAX_MANA(ch)) {
        /* reenqueue the event */
        gain = mana_gain(ch);
        return (PULSES_PER_MUD_HOUR / (gain ? gain : 1));
      }
      break;

    case REGEN_MOVE:
      GET_MOVE(ch) = MIN(GET_MOVE(ch) + 1, GET_MAX_MOVE(ch));
      if (ch->in_room == NOWHERE)
        return;
      if (GET_MOVE(ch) < GET_MAX_MOVE(ch)) {
        /* reenqueue the event */
        gain = move_gain(ch);
        return (PULSES_PER_MUD_HOUR / (gain ? gain : 1));
      }
      break;

    default:
      sprintf(logbuf, "SYSERR:  Unknown points event type %d", type);

gcc -c -g -O2 -Wall  regen.c
regen.c: In function `points_event':
regen.c:65: warning: `return' with a value, in function returning void
regen.c:76: warning: `return' with a value, in function returning void
regen.c:87: warning: `return' with a value, in function returning void
regen.c:95: warning: `return' with a value, in function returning void
regen.c:102: warning: `return' with a value, in function returning void

seems to me the function is supposed to return a regen value on the
pulse of the event. The return line looks to me like its supposed to
return 750/1
this cant be right
if anyone has a clue about this please let me in on it. i been thru the
archives docs and other such support and now im losing hair. i even made
sure that i never called direct values for get_hit etc.

Thanks

--
John Hines
Don't forget the Tiedye!   http://www.tiedye.org/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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