[ Code ] Mobprogs and Oasis...

From: David Klasinc (bigwhale@CAPYBARA.SK-PTTSC.LJ.EDUS.SI)
Date: 09/14/97


Banzai!

 Hm, I'm back from too short vacation and I'm already fighting with
bugs... :)


I was complaning about mobprogs that are loaded from separate files and
that Oasis saves them in .mob files. So I decided to fix that, here's how
I did it (not really done yet one weird bug has appeared):

in structs.h I changed the mob_porg_data structure to this:

 struct mob_prog_data {
  struct mob_prog_data *next;
  int type;
  char *arglist;
  char *comlist;
  char *fromfile;
};


In db.c MPROG_DATA* mprog_file_read(char *f, MPROG_DATA *mprg,
                             struct index_data *pMobIndex)


after the lines

  mprg2->arglist       = fread_string(progfile, buf2);
  mprg2->comlist       = fread_string(progfile, buf2);


I added : mprg2->fromfile      = MOBProgfile;

Ok, now fromfile is the same as whole path to the file. after this line I
also added log(mprg2->fromfile); to see if fromfile gets set and it does.
At the reboot my screen get's spammed with filnames of mobprogs :) Hoorah!
I say and I go to the medit.c to include this in Oasis (first I just
wanted for the filenames to be shown in the editor and nothing to do about
them)

So I changed medit_disp_mprog() and replaced old sprintf call with this
one:

      sprintf (buf, "%d) %s %s -> %s\r\n",
               d->edit_number2,
               medit_get_mprog_type(mprog),
               (mprog->arglist ? mprog->arglist : "NONE"),
               (mprog->fromfile ? mprog->fromfile : "NONE"));
      log(mprog->fromfile);

And there comes the bug... Somehow fromfile is always NULL no matter
what... If the mobprogs is loaded from separate file or from .mob file...
Which means that char *fromfile; is simply stripped off  the mob_ptog_data
structure somewhere after the boodup and during loading mob into medit...

Any Ideas where could I start looking?! I'm starting to get desperate... I
don't like the feeling btw.. ;> *cackle*


David!


     +------------------------------------------------------------+
     | 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/08/00 PST