More on Obuild and 128

From: Zervun (zervun@EARTHLINK.NET)
Date: 01/18/98


Well I've started diving in and trying to convert obuild to the 128
bitvector stuff.  Some of the fixes seem to be simple however
I'm having trouble with sprintbits/sprintbitarray

void sprintbits is what obuild uses -

void sprintbits(long vektor,char *outstring)
{
  int i;
  char flags[53]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

  strcpy(outstring,"");
  for (i=0;i<32;i++)
  {
    if (vektor & 1) {
      *outstring=flags[i];
      outstring++;
    };
    vektor>>=1;
  };
  *outstring=0;
};


the 128 bit stuff is quite a bit different seen below

void sprintbitarray(int bitvector[], char *names[], int maxar, char
*result)
{
  int nr, teller, found = FALSE;

  *result = '\0';

  for(teller = 0; teller < maxar && !found; teller++)
    for (nr = 0; nr < 32 && !found; nr++) {
      if (IS_SET_AR(bitvector, (teller*32)+nr))
        if (*names[(teller*32)+nr] != '\n') {
          if (*names[(teller*32)+nr] != '\0') {
            strcat(result, names[(teller*32)+nr]);
            strcat(result, " ");
          }
        } else {
          strcat(result, "UNDEFINED ");
        }
      if (*names[(teller*32)+nr] == '\n')
        found = TRUE;
    }

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

Should I convernt the sprintbits to the sprintbitarray style
or just use sprintbits1, sprintbits2, sprintbits3, etc
and do something like

sprintbits1(MOB_FLAGS(mob_proto + i), actions);
sprintbits2(MOB_FLAGS(mob_proto + i), actions1);
sprintbits3(MOB_FLAGS(mob_proto + i), actions2);

(from int mobs_to_file in act.build.c)
fprinf(new_file, "%s %s %s %s %s %s %s %s %i %c\n", actions,
actions1, actions2, actions3, affects1, affects2, affects3, affects4,
GET_ALIGNMENT(mob_proto + i), type_e ? 'E' : 'S');

I've tried it this way and havn't had much success.

Any help would be greatly appreciated

zervun@earthlink.net


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