SET_BIT and xSET_BIT

Posted by Typhon on Sun 29 Feb 2004 10:03 AM — 5 posts, 18,754 views.

USA #0
i dont really fully grasp the whole bit thing.. but..
i was curious as to whether or not oset can be changed to use xSET_BIT when adding affects to items.
oset item affect affected <flag>
well after the 32nd flag it wraps around and ive got something like 46 flags :( so i cant add anything past..
aqua_breath and thats a stock flag :\
tanks
-typ
Amended on Sun 29 Feb 2004 10:04 AM by Typhon
Canada #1
Check this, this will explain it: http://www.auricmud.com/snippets/bitvectors.html. So yeah, you can have more than 32, up to a whatever you choose to make it.
USA #2
lol ok i get the bitvectors and xbit vectors.. but how bout SET_BIT andxSET_BIT.. whats the difference between those and is there an easy way to change objects or would i have to rewrite everything that has to do with objects(save/load/oset)?
Australia Forum Administrator #3
SET_BIT is designed for a single int (32 bits) whereas xSET_BIT is designed for an extended bitvector which is a structure of 4 ints, see here:


/*
 * Defines for extended bitvectors
 */
#ifndef INTBITS
  #define INTBITS       32
#endif
#define XBM             31      /* extended bitmask   ( INTBITS - 1 )   */
#define RSV             5       /* right-shift value  ( sqrt(XBM+1) )   */
#define XBI             4       /* integers in an extended bitvector    */
#define MAX_BITS        XBI * INTBITS
/*
 * Structure for extended bitvectors -- Thoric
 */
struct extended_bitvector
{
    int         bits[XBI];
};


Trying to use xSET_BIT for a normal int or SET_BIT on an extended vector will just give heaps of errors, and not work.

You would need to change the thing you want to use more bits on, to extended_bitvector, then change all the places which set, or get, those bits, plus change the way it is read/written to the area files.
USA #4
ugh sounds like to much work :\