Files
Bubberstation/code/__DEFINES/_bitfields.dm
LemonInTheDark ded0ee6362 Bitflag Metainfo, Usable (Happy 90000th) (#90000)
## About The Pull Request

Makes wrapper procs to support working with bitflags as defined "things"
rather then EXCLUSIVELY numbers, mostly for getting random flags.

I've ~~also added a unit test to prevent bitfields from being double
defined~~ stolen some code form moth to make double definitions here a
compile error.

This does rely on people actually using the bitfield lists, essentially
upgrading them from breaking just admin debug to POTENTIALLY breaking
game logic (slightly). Would like input on this @tgstation/commit-access

## Why It's Good For The Game

More tools for feature coders to play with, more sane code
2025-03-19 19:54:03 +00:00

9 lines
388 B
Plaintext

#define DEFINE_BITFIELD(_variable, _flags) \
/* Important note: This exists to throw a compile time warning if more then one bitfield with the same name is defined */ \
/* This is required to avoid dupes in vv, and any consumers of our bitfield metainfo procs */ \
GLOBAL_REAL_VAR(_bitfield_##_variable); \
/datum/bitfield/##_variable { \
flags = ##_flags; \
variable = #_variable; \
}