当前位置: 首页>>代码示例>>C++>>正文


C++ FLAGS函数代码示例

本文整理汇总了C++中FLAGS函数的典型用法代码示例。如果您正苦于以下问题:C++ FLAGS函数的具体用法?C++ FLAGS怎么用?C++ FLAGS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FLAGS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Kpp_DeleteFunc

BOOL PEXPORT Kpp_DeleteFunc(FUNCID idFunc)
{
    LPFUNC lpFunc = (LPFUNC) KppGetItem(FUNC, idFunc);
    
    if (!lpFunc)
        return ERROR;

    if (FLAGS(lpFunc) & ITEMOPEN)
        return KppRegisterKappaMessage(hResThisDll, IDE_BEINGEDITED,
                                       lpIDs->idError, NAME(lpFunc), NULLID);

    /* Check for system defined function */
    if (FLAGS(lpFunc) & UNDELETABLE)
    {
        KppReleaseItem(FUNC, idFunc);
        return KppRegisterKappaMessage(hResThisDll, IDE_NOSYSDELETE,
                                       lpIDs->idError, NAME(lpFunc), NULLID);
    }

    /* first clear up the function */
    Kpp__ResetFunc(lpFunc);

    /* then delete the func itself */
    KppReleaseItem(FUNC, idFunc);
    KppDeleteItem(FUNC, idFunc);

    /* Add to KnowledgeTools */
    KppAddItemCB(FUNC, -1);

    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:31,代码来源:KFUNC.C

示例2: __CopyRule

RULEID __CopyRule(LPRULE lpOldRule, ITEMID idName)
{
#ifdef INFERENCE
    RULEID      idRule;
    LPRULE      lpRule;
    LPEXP       lpBody;
    EXPID       idBody;

    if (GetRule(idName) != NULLID)
        return NULLID;
    
    idRule = KppAddItemAndName (RULE, (LPLPSTR)&lpRule, idName);
    if (!idRule)
        return NULLID;
    NAME(lpRule) = idName;
    FLAGS(lpRule) = NULL;
    PRIORITY(lpRule) = 0;
    MATCHES(lpRule) = NULLID;
    NUMVARS(lpRule) = NUMVARS(lpOldRule);
    if (! (FLAGS(lpRule) & CBODY))
    {
        VARS(lpRule) = KppDeepListCopy(VARS(lpOldRule), Kpp__CopyVar,idRule);
        idBody = BODY(lpRule) = KppCopyExp(
                        BODY(lpOldRule), (LPLPSTR)&lpBody, kPERMMODE);
        KppReleaseExp(idBody);
    }
    KppReleaseItem(RULE, idRule);

    /* Add to KnowledgeTools */
    KppAddItemCB (RULE, 1);

    return idRule;
#endif
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,代码来源:KFUNC.C

示例3: can_see

bool
can_see(dbref player, dbref thing, bool can_see_loc)
{
    if (!OkObj(player) || !OkObj(thing))
        return 0;

    if (player == thing || Typeof(thing) == TYPE_EXIT
        || Typeof(thing) == TYPE_ROOM)
        return 0;

    if (Light(thing))
        return 1;

    if (can_see_loc) {
        switch (Typeof(thing)) {
            case TYPE_PROGRAM:
                return ((FLAGS(thing) & LINK_OK) || controls(player, thing)
                        || (POWERS(player) & POW_SEE_ALL));
            case TYPE_PLAYER:
                if (tp_dark_sleepers) {
                    return (!Dark(thing) || online(thing)
                            || (POWERS(player) & POW_SEE_ALL));
                }
            default:
                return (!Dark(thing) || (POWERS(player) & POW_SEE_ALL) ||
                        (controls(player, thing) && !(FLAGS(player) & STICKY)));

        }
    } else {
        /* can't see loc */
        return (controls(player, thing) && !(FLAGS(player) & STICKY));
    }
}
开发者ID:nekosune,项目名称:protomuck,代码行数:33,代码来源:predicates.c

示例4: Kpp_DeleteGoal

BOOL PEXPORT Kpp_DeleteGoal(GOALID idGoal)
{
#ifdef INFERENCE
    ATOMID idName;
    LPGOAL lpGoal;

    if ((lpGoal = (LPGOAL) KppGetItem(GOAL, idGoal)) == NULL)
        return ERROR;
    if (FLAGS (lpGoal) & ITEMOPEN)
        return KppRegisterKappaMessage (hResThisDll, 
            IDE_BEINGEDITED, lpIDs->idError, NAME(lpGoal), NULLID);

    /* Check for system defined goal */
    if (FLAGS(lpGoal) & UNDELETABLE)
        {
        idName = NAME (lpGoal);
        KppReleaseItem(GOAL, idGoal);
        return KppRegisterKappaMessage (hResThisDll, 
            IDE_NOSYSDELETE,lpIDs->idError, idName, NULLID);
        } /* if */

    /* reset the goal contents */
    Kpp__ResetGoal(lpGoal);

    /* then delete the goal itself */
    KppReleaseItem(GOAL, idGoal);
    KppDeleteItem(GOAL, idGoal);

    /* Add to KnowledgeTools */
    KppAddItemCB (GOAL, -1);

#endif
    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,代码来源:KFUNC.C

示例5: SetMarkFile

/*** SetMarkFile - Change markfile
*
* Purpose:
*
*   Changes to a new markfile.
*
* Input:
*   val - String after the 'markfile' switch
*
* Output:
*
*   Returns Error string if error, NULL otherwise
*
* Notes:
*
*   We:
*
* UNDONE:o Magically ensure that the current markfile is up to date and
*	  saved to disk.  This means, at the very least, that there
*	  can be no dirty files.
*
*	o Remove the current markfile from the file list.
*
*	o Read in the new markfile.
*
*	o Invalidate all current marks.  This is just marking them
*	  invalid in the PFILE.
*
*
*************************************************************************/
char *
SetMarkFile (
    char *val
    ) {

    REGISTER PFILE pFile;
    buffer  tmpval;
    pathbuf pathname;

    strcpy ((char *) tmpval, val);

    if (NULL == CanonFilename (tmpval, pathname)) {
        sprintf (buf, "'%s': name is malformed", tmpval);
        return buf;
    }

    if (!(pFile = FileNameToHandle (pathname, NULL))) {
        pFile = AddFile (pathname);
    }

    if (!TESTFLAG(FLAGS(pFile), REAL) && !FileRead (pathname, pFile, FALSE)) {
        RemoveFile (pFile);
        sprintf (buf, "'%s' - %s", pathname, error());
        return buf;
    }

    pFileMark = pFile;

    for (pFile = pFileHead; pFile; pFile = pFile->pFileNext) {
        if (!TESTFLAG(FLAGS(pFile), FAKE)) {
            RSETFLAG (FLAGS(pFile), VALMARKS);
        }
    }
    return NULL;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:65,代码来源:mark.c

示例6: opt_default

int opt_default(const char *opt, const char *arg)
{
    const AVOption *oc, *of, *os;
    char opt_stripped[128];
    const char *p;
    const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc;

    if (!(p = strchr(opt, ':')))
        p = opt + strlen(opt);
    av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));

    if ((oc = av_opt_find(&cc, opt_stripped, NULL, 0, AV_OPT_SEARCH_CHILDREN|AV_OPT_SEARCH_FAKE_OBJ)) ||
         ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
          (oc = av_opt_find(&cc, opt+1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
        av_dict_set(&codec_opts, opt, arg, FLAGS(oc));
    if ((of = av_opt_find(&fc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
        av_dict_set(&format_opts, opt, arg, FLAGS(of));
#if CONFIG_SWSCALE
    sc = sws_get_class();
    if ((os = av_opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
        // XXX we only support sws_flags, not arbitrary sws options
        int ret = av_set_string3(sws_opts, opt, arg, 1, NULL);
        if (ret < 0) {
            av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
            return ret;
        }
    }
#endif

    if (oc || of || os)
        return 0;
    av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
    return AVERROR_OPTION_NOT_FOUND;
}
开发者ID:Tjoppen,项目名称:FFmpeg,代码行数:34,代码来源:cmdutils.c

示例7: skipproperties

void
skipproperties(FILE * f, dbref obj)
{
    char buf[BUFFER_LEN * 3];
    int islisten = 0;

    /* get rid of first line */
    fgets(buf, sizeof(buf), f);

    fgets(buf, sizeof(buf), f);
    while (strcmp(buf, "*End*\n")) {
        if (!islisten) {
            if (string_prefix(buf, "_listen"))
                islisten = 1;
            if (string_prefix(buf, "~listen"))
                islisten = 1;
            if (string_prefix(buf, "~olisten"))
                islisten = 1;
        }
        fgets(buf, sizeof(buf), f);
    }
    if (islisten) {
        FLAGS(obj) |= LISTENER;
    } else {
        FLAGS(obj) &= ~LISTENER;
    }
}
开发者ID:revarbat,项目名称:fuzzball,代码行数:27,代码来源:diskprop.c

示例8: unparse_object

const char *
unparse_object(dbref player, dbref loc)
{
	static char buf[BUFFER_LEN];
	if (player == NOTHING)
		goto islog;
	if (Typeof(player) != TYPE_PLAYER)
		player = OWNER(player);
islog:
	switch (loc) {
	case NOTHING:
		return "*NOTHING*";
	case AMBIGUOUS:
		return "*AMBIGUOUS*";
	case HOME:
		return "*HOME*";
	default:
		if (loc < 0 || loc >= db_top)
			return "*INVALID*";

		if ((player == NOTHING) || (!(FLAGS(player) & STICKY) &&
			(can_link_to(player, NOTYPE, loc) ||
			 ((Typeof(loc) != TYPE_PLAYER) &&
			  (controls_link(player, loc) || (FLAGS(loc) & CHOWN_OK)))))) {
			/* show everything */
			snprintf(buf, sizeof(buf), "%.*s(#%d%s)", (BUFFER_LEN / 2), NAME(loc), loc, unparse_flags(loc));
			return buf;
		} else {
			/* show only the name */
			return NAME(loc);
		}
	}
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:33,代码来源:unparse.c

示例9: Kpp_DeleteRule

BOOL PEXPORT Kpp_DeleteRule(RULEID idRule)
{
#ifdef INFERENCE
    ATOMID idName;
    LPRULE lpRule;

    if ((lpRule = (LPRULE) KppGetItem(RULE, idRule)) == NULL)
        return ERROR;
    if (FLAGS (lpRule) & ITEMOPEN)
        return KppRegisterKappaMessage (hResThisDll, 
            IDE_BEINGEDITED, lpIDs->idError, NAME(lpRule), NULLID);

    /* Check for system defined rule */
    if (FLAGS(lpRule) & UNDELETABLE)
        {
        idName = NAME (lpRule);
        KppReleaseItem(RULE, idRule);
        return KppRegisterKappaMessage (hResThisDll, 
                IDE_NOSYSDELETE,lpIDs->idError, idName, NULLID);
        } /* if */

    /* first clear up the rule */
    Kpp__ResetRule(lpRule);

    /* finally delete the rule itself */
    KppReleaseItem(RULE, idRule);
    KppDeleteItem(RULE, idRule);

    /* Add to KnowledgeTools */
    KppAddItemCB (RULE, -1);
    KppChangeRuleCB ();

    #endif
    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:35,代码来源:KFUNC.C

示例10: do_prog

/*
  Use this to create a program.
  First, find a program that matches that name.  If there's one,
  then we put him into edit mode and do it.
  Otherwise, we create a new object for him, and call it a program.
  */
void
do_prog(int descr, dbref player, const char *name)
{
    dbref i;
    struct match_data md;

    if (Typeof(player) != TYPE_PLAYER) {
        anotify_nolisten2(player, CFAIL "Only players can edit programs.");
        return;
    } else if (!Mucker(player)) {
        anotify_nolisten2(player, CFAIL NOMBIT_MESG);
        return;
    } else if (!tp_building || tp_db_readonly) {
        anotify_nolisten2(player, CFAIL NOBUILD_MESG);
        return;
    } else if (!*name) {
        anotify_nolisten2(player, CINFO "No program name given.");
        return;
    }

    init_match(descr, player, name, TYPE_PROGRAM, &md);
    match_possession(&md);
    match_neighbor(&md);
    match_registered(&md);
    match_absolute(&md);

    if ((i = match_result(&md)) == NOTHING) {
        i = new_program(OWNER(player), name);
        FLAGS(i) |= INTERNAL;
        DBFETCH(player)->sp.player.curr_prog = i;

        anotify_fmt(player, CSUCC "Program %s created with number %d.", name,
                    i);
        anotify_nolisten2(player, CINFO "Entering editor.");
    } else if (i == AMBIGUOUS) {
        anotify_nolisten2(player, CINFO "I don't know which one you mean!");
        return;
    } else {
        if ((Typeof(i) != TYPE_PROGRAM) || !controls(player, i)) {
            anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);
            return;
        } else if (FLAGS(i) & INTERNAL) {
            anotify_nolisten2(player, CFAIL NOEDIT_MESG);
            return;
        }

        DBFETCH(i)->sp.program.first = read_program(i);
        FLAGS(i) |= INTERNAL;
        DBFETCH(player)->sp.player.curr_prog = i;
        anotify_fmt(player, CINFO "Entering editor for %s.",
                    unparse_object(player, i));
        /* list current line */
        do_list(player, i, 0, 0, 0);
        DBDIRTY(i);
    }

    FLAGS(player) |= INTERACTIVE;
    DBDIRTY(player);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:65,代码来源:create.c

示例11: could_doit

/*
 * could_doit: Checks to see if player could actually do what is proposing
 * to be done: if thing is an exit, this checks to see if the exit will
 * perform a move that is allowed. Then, it checks the @lock on the thing,
 * whether it's an exit or not.
 */
int
could_doit(int descr, dbref player, dbref thing)
{
	dbref source, dest, owner;

	if (Typeof(thing) == TYPE_EXIT) {
			/* If exit is unlinked, can't do it. */
		if (DBFETCH(thing)->sp.exit.ndest == 0) {
			return 0;
		}

		owner = OWNER(thing);
		source = DBFETCH(player)->location;
		dest = *(DBFETCH(thing)->sp.exit.dest);

		if (Typeof(dest) == TYPE_PLAYER) {
			/* Check for additional restrictions related to player dests */
			dbref destplayer = dest;

			dest = DBFETCH(dest)->location;
			/* If the dest player isn't JUMP_OK, or if the dest player's loc
			 * is set BOUND, can't do it. */
			if (!(FLAGS(destplayer) & JUMP_OK) || (FLAGS(dest) & BUILDER)) {
				return 0;
			}
		}

		/* for actions */
		if ((DBFETCH(thing)->location != NOTHING) &&
			(Typeof(DBFETCH(thing)->location) != TYPE_ROOM)) {

			/* If this is an exit on a Thing or a Player... */

			/* If the destination is a room or player, and the current
			 * location is set BOUND (note: if the player is in a vehicle
			 * set BUILDER this will also return failure) */
			if ((Typeof(dest) == TYPE_ROOM || Typeof(dest) == TYPE_PLAYER) &&
				(FLAGS(source) & BUILDER)) return 0;

			/* If secure_teleport is true, and if the destination is a room */
			if (tp_secure_teleport && Typeof(dest) == TYPE_ROOM) {
				/* if player doesn't control the source and the source isn't
				 * set Jump_OK, then if the destination isn't HOME,
				 * can't do it.  (Should this include getlink(owner)?  Not
				 * everyone knows that 'home' or '#-3' can be linked to and
				 * be treated specially. -winged) */
				if ((dest != HOME) && (!controls(owner, source))
					&& ((FLAGS(source) & JUMP_OK) == 0)) {
					return 0;
				}
			/* FIXME: Add support for in-server banishment from rooms
			 * and environments here. */
			}
		}
	}

		/* Check the @lock on the thing, as a final test. */
	return (eval_boolexp(descr, player, GETLOCK(thing), thing));
}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:65,代码来源:predicates.c

示例12: mfn_force

const char *
mfn_force(MFUNARGS)
{
    char *nxt, *ptr;
    dbref obj = mesg_dbref_raw(player, what, perms, argv[0]);
    if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
        ABORT_MPI("FORCE","Failed match. (arg1)");
    if (obj == PERMDENIED)
        ABORT_MPI("FORCE","Permission denied. (arg1)");
    if (Typeof(obj) != TYPE_THING && Typeof(obj) != TYPE_PLAYER)
        ABORT_MPI("FORCE","Bad object reference. (arg1)");
    if (!*argv[1])
        ABORT_MPI("FORCE","Null command string. (arg2)");
    if (!tp_zombies && !Wizperms(perms))
        ABORT_MPI("FORCE","Permission Denied.");
    if (!Wizperms(perms)) {
	const char *ptr = RNAME(obj);
	char objname[BUFFER_LEN], *ptr2;
	dbref loc = getloc(obj);

	if (Typeof(obj) == TYPE_THING) {
	    if (FLAGS(obj) & DARK)
		ABORT_MPI("FORCE","Cannot force a dark puppet.");
	    if ((FLAGS(OWNER(obj)) & ZOMBIE))
		ABORT_MPI("FORCE","Permission denied.");
	    if (loc != NOTHING && (FLAGS(loc) & ZOMBIE) &&
		    Typeof(loc) == TYPE_ROOM)
		ABORT_MPI("FORCE","Cannot force a Puppet in a no-puppets room.");
	    for (ptr2 = objname; *ptr && !isspace(*ptr);)
		*(ptr2++) = *(ptr++);
	    *ptr2 = '\0';
	    if (lookup_player(objname) != NOTHING)
		ABORT_MPI("FORCE","Cannot force a thing named after a player.");
	}
	if (!(FLAGS(obj) & XFORCIBLE)) {
	    ABORT_MPI("FORCE","Permission denied: forced object not @set Xforcible.");
	}
	if (!test_lock_false_default(perms, obj, "@/flk")) {
	    ABORT_MPI("FORCE","Permission denied: Object not force-locked to trigger.");
	}
    }
    if (God(obj))
	ABORT_MPI("FORCE","Permission denied: You can't force God.");
    if (force_level)
	ABORT_MPI("FORCE","Permission denied: You can't force recursively.");
    strcpy(buf, argv[1]);
    ptr = buf;
    do {
        nxt = index(ptr, '\r');
        if (nxt) *nxt++ = '\0';
        force_level++;
        if (*ptr) process_command(obj, ptr);
        force_level--;
        ptr = nxt;
    } while (ptr);
    *buf = '\0';
    return "";
}
开发者ID:TealWizard,项目名称:TinyMUCK-Tapestries,代码行数:58,代码来源:mfuns2.c

示例13: can_link_to

int
can_link_to(dbref who, object_flag_type what_type, dbref where)
{
		/* Can always link to HOME */
	if (where == HOME)
		return 1;
		/* Can't link to an invalid dbref */
	if (where < 0 || where >= db_top)
		return 0;
	switch (what_type) {
	case TYPE_EXIT:
		/* If the target is LINK_OK, then any exit may be linked
		 * there.  Otherwise, only someone who controls the
		 * target may link there. */
		return (controls(who, where) || (FLAGS(where) & LINK_OK));
		/* NOTREACHED */
		break;
	case TYPE_PLAYER:
		/* Players may only be linked to rooms, that are either
		 * controlled by the player or set either L or A. */
		return (Typeof(where) == TYPE_ROOM && (controls(who, where)
											   || Linkable(where)));
		/* NOTREACHED */
		break;
	case TYPE_ROOM:
		/* Rooms may be linked to rooms or things (this sets their
		 * dropto location).  Target must be controlled, or be L or A. */
		return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_THING)
				&& (controls(who, where) || Linkable(where)));
		/* NOTREACHED */
		break;
	case TYPE_THING:
		/* Things may be linked to rooms, players, or other things (this
		 * sets the thing's home).  Target must be controlled, or be L or A. */
		return (
				(Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_PLAYER ||
				 Typeof(where) == TYPE_THING) && 
				 (controls(who, where) || Linkable(where)));
		/* NOTREACHED */
		break;
	case NOTYPE:
		/* Why is this here? -winged */
		return (controls(who, where) || (FLAGS(where) & LINK_OK) ||
				(Typeof(where) != TYPE_THING && (FLAGS(where) & ABODE)));
		/* NOTREACHED */
		break;
	default:
		/* Programs can't be linked anywhere */
		return 0;
		/* NOTREACHED */
		break;
	}
	/* NOTREACHED */
	return 0;
}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:55,代码来源:predicates.c

示例14: fetchprops_priority

int
fetchprops_priority(dbref obj, int mode, const char *pdir)
{
	const char *s;
	int hitflag = 0;

	/* update fetched timestamp */
	DBFETCH(obj)->propstime = time(NULL);

	/* if in memory, don't try to reload. */
	if (DBFETCH(obj)->propsmode != PROPS_UNLOADED) {

		/* but do update the queue position */
		addobject_ringqueue(obj, DBFETCH(obj)->propsmode);
		if (!pdir)
			pdir = "/";
		while ((s = propdir_unloaded(DBFETCH(obj)->properties, pdir))) {
			propcache_misses++;
			hitflag++;
			if (!mode)
				update_fetchstats();
			if (FLAGS(obj) & SAVED_DELTA) {
				getproperties(delta_infile, obj, s);
			} else {
				getproperties(input_file, obj, s);
			}
		}
		if (hitflag) {
			return 1;
		} else {
			propcache_hits++;
			return 0;
		}
	}

	propcache_misses++;

	housecleanprops();

	/* actually load in root properties from the appropriate file */
	if (FLAGS(obj) & SAVED_DELTA) {
		getproperties(delta_infile, obj, "/");
	} else {
		getproperties(input_file, obj, "/");
	}

	/* update fetch statistics */
	if (!mode)
		update_fetchstats();

	/* add object to appropriate queue */
	addobject_ringqueue(obj, ((mode) ? PROPS_PRIORITY : PROPS_LOADED));

	return 1;
}
开发者ID:rhencke,项目名称:fuzzball,代码行数:55,代码来源:diskprop.c

示例15: makedirty

/*** makedirty
*
*
* Input:
*
* Output:
*
*************************************************************************/
void
makedirty (
    REGISTER PFILE pFileDirty
    ) {
    if (!TESTFLAG(FLAGS(pFileDirty),DIRTY)) {
        if (pFileDirty == pFileHead) {
            SETFLAG (fDisplay, RSTATUS);
        }
	SETFLAG (FLAGS(pFileDirty), DIRTY);
    }
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:19,代码来源:display.c


注:本文中的FLAGS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。