[NEWBIE] Poofin/poofout save weird thing

From: Mark Gerritsen (m.p.h.gerritsen@STUDENT.UTWENTE.NL)
Date: 05/13/98


In an attempt to make poofs save, I completely mimiced the way titles work.
#define POOFIN(ch)      ((ch)->player.poofin) in structs.h, etc...
They -do- save, but whenever a char rents and comes back, the poofin is
what was originally the poofin, PLUS the poofout pasted behind it...
(ie. Havoc appears with an earsplitting bang.Havoc disappears in a puff of
smoke.)
The poofout is just the poofout, and seems to work fine.
I know it's probably something very basic, but I really don't see it.
Any help would be greatly appreciated.

In db.c, I have the following lines:
in store_to_char:
  if (*st->poofin == '\0')
    ch->player.poofin = NULL;
  else
    ch->player.poofin = str_dup(st->poofin);
  if (*st->poofout == '\0')
    ch->player.poofout = NULL;
  else
    ch->player.poofout = str_dup(st->poofout);

in char_to_store:
  if (POOFIN(ch))
    strcpy(st->poofin, POOFIN(ch));
  else
    *st->poofin = '\0';

  if (POOFOUT(ch))
    strcpy(st->poofout, POOFOUT(ch));
  else
    *st->poofout = '\0';

in free_char:
    if (ch->player.poofin)
      free(ch->player.poofin);
    if (ch->player.poofout)
      free(ch->player.poofout);

and further on in free_char:
    if (ch->player.poofin && ch->player.poofin != mob_proto[i].player.poofin)
      free(ch->player.poofin);
    if (ch->player.poofout && ch->player.poofout !=
mob_proto[i].player.poofout)
      free(ch->player.poofout);

I changed do_poofset (act.wizard.c) to be able to see your own poofs:
ACMD(do_poofset)
{
  char **msg;

  if (!*argument) {
    sprintf(buf, "Your current poof%s is:\r\n", (subcmd == SCMD_POOFIN) ?
"in" : "out");
    sprintf(buf, "%s%s", buf,
            (subcmd == SCMD_POOFIN) ? ((POOFIN(ch)) ? POOFIN(ch) : "$n
appears with an ear-splitting bang.") :
            ((POOFOUT(ch)) ? POOFOUT(ch) : "$n disappears in a puff of
smoke."));
    act(buf, TRUE, ch, 0, 0, TO_CHAR);
    return;
  }
  switch (subcmd) {
  case SCMD_POOFIN:    msg = &(POOFIN(ch));    break;
  case SCMD_POOFOUT:   msg = &(POOFOUT(ch));   break;
  default:    return;    break;
  }
  skip_spaces(&argument);
  if (*msg)
    free(*msg);
  *msg = str_dup(argument);
  send_to_char(OK, ch);
}


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



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