On Fri, 15 Aug 1997, Derek L. Karnes wrote: > Easier than the flag is to check the door name for the word "secret" in > the places Nathan mentioned, that way olc and structs.h stays the same. I haven't seen much oasis code, so I dunno how exactly it handles flags. More specifically I don't understand why you have to tell it how many flags it has available. Here's a little function I put together for obuild: /* Find a flag in a given bitvector that matches "txt" and toggle it. "Mask" is a bitvector of flags that can't be set so individual or groups of flags can be untoggleable (ROOM_HOUSE, MOB_SPEC, etc). */ int check_toggle_flags(char *txt, char *names[], int *bitvector, int mask) { int i = 0; if(!*txt || *txt == '\r' || *txt == '\n') return FALSE; while(*names[i] != '\n') { if(!strn_cmp(txt, names[i], strlen(names[i]))) { if((1 << i) & ~mask) { TOGGLE_BIT(*bitvector, 1 << i); return TRUE; } else { return TRUE; } } i++; } return FALSE; } This could be optimized better for speed. It's also limited to accepting a single flag because I wanted to keep the ablility to mix flags and other data in my command arguments. All the flag text constants end with "\n", so you might as well put it to good use. Sam +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST