Instead of using the method described for realy big bitvectors, you could try the bitfield code which I downloaded to the incoming directory of the circle ftp-site. In this bitfield code every flag has it's own 1-bit integer (can be 0 or 1) so setting a flag would simply be something like player.affection.curse = 1; Becouse of the special structure used (bitfield) this wont take more room in memory as normal bitvectors. By the way: A char (signed or unsigned) can never hold more then 8 bits. If you want arbitrary big storage room for flags you should use the bitfield method or an array of chars. A way to adress the flags other then by the bitfield method (integers wouldn't work anymore past 32 bits) could be by using a string for the bits like "ab|hi|d" where the first 26 bits are "a" to "z", and the next 26 bits are "a" to "z" behind a "|", and so on. -------------------------------------------------------------------------- Experienced coders can stop reading here, here folows some explanation how chars are stored in memory. -------------------------------------------------------------------------- As a matter of fact a char consists of exactly 8 bits (a byte), numbers are stored in a char by setting this bits on or off. Each bit has a value and by adding this values together you get the number the char represents. The values of the bits are: 1, 2, 4, 8, 16, 32, 64 and 128 (or -128 for signed). Other ways to represent this numbers are: 2^0, 2^1, .... 2^7 (or -2^7). and 1<<0, 1<<1, .... 1<<7. I prefer this last one (same for signed and unsigned) Mostly the bits are numbered 0 to 7 (don't confuse this with the values) if you type something like 1 & 5 you are doing a "bitwise and" operation on two chars, the first char has bit 0 set and the second bit 0 and bit 2 (values 1 and 4). A & operation gives you the bits which are set in both chars so 1 & 5 would be 1 (and not 6), both 1 and 5 have bit 0 set (value 1). I hope this helps. Jaco
This archive was generated by hypermail 2b30 : 12/07/00 PST