Загрузка данных


#if defined _bitmask_included
    #endinput
#endif
#define _bitmask_included

/**
 * Creates a bitmask for the given position (numbering starts from 0).
 * @param pos Bit position (0–31 for a 32-bit variable).
 *
 * @return Bit mask (1 << %1).
 */
#if !defined _reapi_included
    #define BIT(%1) ( 1 << ( %1 ) )
#endif

/**
 * Converts a player ID (1-based) to a bit position (0-based) and creates a corresponding bit mask.
 * @param pos Gets the player ID and subtracts 1 to get the bit position.
*/
#define BIT_PLAYER(%1) ( BIT( %1 - 1 ) )

/**
 * Sets a bit at a given position.
 * @param var Bitmask variable (changes).
 * @param pos Bit position.
*/
#define BIT_ADD(%1,%2) ( %1 |= BIT_PLAYER( %2 ) )

/**
 * Drops (clears) the bit at the specified position.
 * @param var Bitmask variable (changes).
 * @param pos Bit position.
*/
#define BIT_SUB(%1,%2) ( %1 &= ~BIT_PLAYER( %2 ) )

/**
 * Checks whether a bit at a given position is set.
 * @param var Bitmask variable (changes).
 * @param pos Bit position.
 *
 * @return true if the bit is set; false otherwise.
*/
#define BIT_VALID(%1,%2) ( %1 & BIT_PLAYER( %2 ) )