public void setFlagByBit(int bitmask, boolean enabled) {if (enabled) {flags |= bitmask;} else {flags &= (0xFFFF ^ bitmask);}}
public void SetFlagByBit(int bitmask, bool enabled){if (enabled){flags |= (short)bitmask;}else{flags &= (short)(0xFFFF ^ bitmask);}}