Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ SET_BIT and xSET_BIT

SET_BIT and xSET_BIT

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Typhon   USA  (112 posts)  Bio
Date Sun 29 Feb 2004 10:03 AM (UTC)

Amended on Sun 29 Feb 2004 10:04 AM (UTC) by Typhon

Message
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
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Sun 29 Feb 2004 07:08 PM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #2 on Sun 29 Feb 2004 11:23 PM (UTC)
Message
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)?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 01 Mar 2004 07:47 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #4 on Tue 02 Mar 2004 09:44 PM (UTC)
Message
ugh sounds like to much work :\
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,778 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.