Although ordinary variables work well, sometimes you only need to store a single bit. For this, instead of declaring a byte variable and wasting 7 of the 8 bits, you can use a flag. Flags are packed efficiently in the memory to avoid wasting space. This can be used helpful on small memory platforms.
The bit APIs are the most generic. You provide a bit number and a pointer to a bit buffer where the bits are packed.
The flag APIs operate on a per-player flag buffer. They are also automatically cleared at player start. You only provide a flag number.
The global flag APIs are similar, but those flags are global and do not change across players, nor across games.
Flag and global flag IDs are distinct. Be careful not to pass a global flag ID to a flag API, or vice-versa.
bit_on, flag_on, global_flag_on
bit_off, flag_off, global_flag_off
bit_toggle, flag_toggle, global_flag_toggle
bit_test, flag_test, global_flag_test