by Spike » Tue May 21, 2013 11:36 am
standard/traditional notation:
to set: self.flags = self.flags | FL_BLAH;
to clear: self.flags = self.flags - (self.flags & FL_BLAH);
hexenc notation (works with fteqcc):
to set: self.flags (+) FL_BLAH;
to clear: self.flags (-) FL_BLAH;
more c-like notation (works with fteqcc):
to set: self.flags |= FL_BLAH;
to clear: self.flags &~= FL_BLAH;
As a general rule, you should never directly add nor subtract bitflags, for consistancy you should keep such logic using bitwise operations as it means you're less likely to end up using non-bitwise-safe operations on them, and its easier to see such unsafe operations. The exception to this rule is that QC does not support bit-wise not, thus with standard qc you don't have a choice but to subtract a masked copy of the value (the other notations internally do the same).
.