[long] AFF2 flag

From: Ray Campbell (thrawn@cox.net)
Date: 06/04/02


I decided to go the AFF2 route after many failed attempts at adding 128 bits to my
heavily modified, now pl19 code base.  This question is posed pertaining to ASCII pfiles
and the saving of the AFF2 flags to the file.  I copied all instances of AFF, in db.c (I believe this is the only place that handles setting up the pfiles?)  My code compiles just fine, but the AFF2 flags aren't actually working.  No weird crashes are happening, it just won't affect the character.  
--snip--

      case 'A':
        if(!strcmp(tag, "Ac  "))
          GET_AC(ch) = num;
        else if(!strcmp(tag, "Act "))
          PLR_FLAGS(ch) = num;
        else if(!strcmp(tag, "Aff "))
          AFF_FLAGS(ch) = asciiflag_conv(line);
        else if (!strcmp(tag, "Aff2 "))
          AFF2_FLAGS(ch) = asciiflag_conv(line);
        else if(!strcmp(tag, "Affs")) {
          i = 0;
          do {
            fbgetline(fl, line);
            sscanf(line, "%d %d %d %d %d %d", &num, &num2, &num3, &num4, &num5, &num6);
            if(num > 0) {
              af.type = num;
              af.duration = num2;
              af.modifier = num3;
              af.location = num4;
              af.bitvector = num5;
              af.bitvector2 = num6;
              affect_to_char(ch, &af);
              i++;
            }
          } while (num != 0);
        } else if(!strcmp(tag, "Alin"))
--snip--
above, num6 was added with the af.bitvector2 in db.c, to me this seemed like the obvious
place where it was setting up the structure of what to write in the pfile.  Again, I just followed all instances of AFF.  Does anyone see a problem with the above.  One thing I was unsure of, is if that I had to actually make all new af.xxx structures, for the new aff2 flags.  It appeared that just adding a  .bitvector2 to struct affected_type in structs.h should do the trick.  Perhaps i'm wrong?  
My other question, and this I believe is what is making the actuall AFF2 flag not stick to the character to begin with is this in utils.c:
void sprintbit(bitvector_t bitvector, const char *names[], char *result)
{
  long nr;

  *result = '\0';

  for (nr = 0; bitvector; bitvector >>= 1) {
    if (IS_SET(bitvector, 1)) {
      if (*names[nr] != '\n') {
        strcat(result, names[nr]);
        strcat(result, " ");
      } else
        strcat(result, "UNDEFINED ");
    }
    if (*names[nr] != '\n')
      nr++;
  }

  if (!*result)
    strcpy(result, "NOBITS ");
}

I tried adding the bitvector2 into the for loop, and also the void, but then I got a ton of mismatches on compilation, so i put it back to the stock for, above.  I was wondering if I would have to write a complete new sprintbit2 ? or if there was a way I could add the bitvector2 into that loop so It would set the affection to the character.

I do believe, perhaps, if this second hurdle is conqoured, than the first will work, for if it actually ever sets the bit, it might actually save the thing.  
Just incase anything here does not appear to be stock, this is what I'm running:
Circle 3.0 patched up to bpl19, originally started on bpl8
ASCII pfiles
OLC v 2.0
DG Scripts v7 .99 or whathaveyou.
Assemblies (thanks del, your bundle_b on the ftp site helped my figure that out)
Running on a Redhat Linux system v 6.2.
--Ray


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.365 / Virus Database: 202 - Release Date: 05/24/2002

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT