Object saving...

From: blah (merren@mindcryme.com)
Date: 01/13/99


I'm currently working on some code to be able to save dynamic items. It
does work, as long as the item (mudmail or whatever) isn't inside of a
container. I just can't seem to get it to save if it's in a container. An
odd thing... If you're holding 2 pieces of mail, 1 in a bag, the other
just in your inventory, it actually works. If you only have 1 (or 3, etc)
it won't save it to the file. Here's what I have:

  for (obj = ch->carrying; obj; obj = obj->next_content) {
   if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER)
    for (tobj = obj->contains; tobj; tobj = tobj->next_content)
     if (IS_OBJ_STAT(tobj, ITEM_UNIQUE)) {
       fprintf(ptFHndl, "%s~\n", tobj->name);
       fprintf(ptFHndl, "%s~\n", tobj->short_description);
       fprintf(ptFHndl, "%s~\n", tobj->description);
      if (tobj->action_description)
         fprintf(ptFHndl, "%s~\n", tobj->action_description);
      else
         fprintf(ptFHndl, "~\n");
     }
   if (IS_OBJ_STAT(obj, ITEM_UNIQUE) && (find_eq_pos(ch, obj, NULL) < 0)) {
      fprintf(ptFHndl, "%s~\n", obj->name);
      fprintf(ptFHndl, "%s~\n", obj->short_description);
      fprintf(ptFHndl, "%s~\n", obj->description);
      if (obj->action_description)
        fprintf(ptFHndl, "%s~\n", obj->action_description);
      else
        fprintf(ptFHndl, "~\n");
   }
  }



Obviously, this is just part of it, I also go through EQ, etc... This is
just preliminary and I'm concentrating on mudmail only right now (thus the
amount of things I'm actually writting to file at the moment) and when I'm
done any dynamic object will be able to be saved, which is the goal. But
first I need this in-a-container part to work. Any ideas?

Melen
Allanthya.org 4000
Belgaweeny's original molester.


     +------------------------------------------------------------+
     | 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