state_to_mask
((cmd.c_levels & state_to_mask(cur_state)) == 0 &&
lvl_mask = state_to_mask(cur_state);
static int state_to_mask(int);