Re: [Newbie] Ascii pfile saving/loading with 128 bit code

From: Patrick Dughi (dughi@imaxx.net)
Date: 04/04/00


> I'm having a bit of difficulty installing the 128 bit code into my rather
> heavily modified mud.  The current conflict I'm having deals with the
> playerfile saving/loading routines, in which the ascii pfile code makes
> calls with asciiflag_conv() to what used to be a single argument but now has
> to deal with an array of flags instead.  The original ascii pfile code uses
> this in db.c load_char:
>
> case 'A':
>   if(!strcmp(tag, "Ac  "))
>     cpd->armor = num;
>   else if(!strcmp(tag, "Act "))                          <--
>     csds->act = num;                                           |  these are
> now arrays of flags,
>   else if(!strcmp(tag, "Aff "))                                |  for
> instance
>     csds->affected_by = asciiflag_conv(line);   <--
>   else if(!strcmp(tag, "Affs")) {


        I've never used 128 bit flags, but from what I remember hearing
about them from a while back, they were basically a set of macros to allow
for 4 normal sets of 32 bits to be accessed as one unit.  I have seen
asciiflag_conv before though - it simply takes a numeric line (what you
get after bitvectors are all added up) and converts it into a more
editable syntax... a=1, b=2, c=4, d=8,etc...

        I would guess that in save you're going to have to print out each
32 bits seperately (examine code to find out what the bits are called).
Something like;

  sprintf(outgoing_buffer,"Affs: %s %s %s %s\n",
        convert_to_asciiflag(BIT_VECTOR_ONE(ch)),
                .
                .
                .);
        And for reading in;

        sscanf(line,"%s %s %s %s", bit1,bit2,bit3,bit4;
        BIT_VECTOR_ONE(ch) = asciiflag_conv(bit1);
                .
                .
                .

        I'm sure though someone will be more than happy to share their
code, but you could probably work through it before then if you try hard.

                                                PjD


     +------------------------------------------------------------+
     | 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 : 04/10/01 PDT