Loading and Extracting

From: Ron Hensley (ron@cross.dmv.com)
Date: 12/02/96


Hello,

Okay on a few occasions ive run across situations where i know the vnum of
a mob for instance. And I need to process the mob for a bit, then im done
with it. At no time is it loaded into a room. So ive tried something like:


  void foobar(int mobnum) {
    struct char_data *tmp_mob;

    tmp_mob = read_mobile(mobnum, VIRTUAL);
    sprintf(buf,"Mobs name is: %s\r\n", GET_NAME(tmp_mob));
    extract_char(tmp_mob);
  }

Now all this works fine up till the extract_char call, which always
results in a seg violation and core dump. Ive gotten around it by just not
extracting the tmp_mob, but I realize this means im mallocing memory, as
read_mobil calls CREATE(), then im not freeing it up. Not good.

Has anyone run into this situation and have a pointer how to load
something up, obj or char, process it as a normal obj/char, then delete it
without blowing things up.

		Thanks in advance



    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Systems Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************

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



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