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


C++ DBFETCH函数代码示例

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


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

示例1: notify_except

void
notify_except(dbref first, dbref exception, const char *msg, dbref who)
{
	dbref room, srch;

	if (first != NOTHING) {

		srch = room = DBFETCH(first)->location;

		if (tp_listeners) {
			notify_from_echo(who, srch, msg, 0);

			if (tp_listeners_env) {
				srch = DBFETCH(srch)->location;
				while (srch != NOTHING) {
					notify_from_echo(who, srch, msg, 0);
					srch = getparent(srch);
				}
			}
		}

		DOLIST(first, first) {
			if ((Typeof(first) != TYPE_ROOM) && (first != exception)) {
				/* don't want excepted player or child rooms to hear */
				notify_from_echo(who, first, msg, 0);
			}
		}
	}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:28,代码来源:speech.c

示例2: prim_timestamps

void 
prim_timestamps(PRIM_PROTOTYPE)
{
    CHECKOP(1);
    oper1 = POP();
    if (mlev < LM2)
	abort_interp("M2 prim");
    if (oper1->type != PROG_OBJECT)
	abort_interp("Non-object argument (1)");
    ref = oper1->data.objref;
    if (ref >= db_top || ref <= NOTHING)
      abort_interp("Dbref is not an object nor garbage.");
/*    if (!valid_object(oper1))
	abort_interp("Invalid object"); */
/*    CHECKREMOTE(oper1->data.objref); */
    CHECKREMOTE(ref);
    CHECKOFLOW(4);
/*    ref = oper1->data.objref; */
    CLEAR(oper1);
    result = DBFETCH(ref)->ts.created;
    PushInt(result);
    result = DBFETCH(ref)->ts.modified;
    PushInt(result);
    result = DBFETCH(ref)->ts.lastused;
    PushInt(result);
    result = DBFETCH(ref)->ts.usecount;
    PushInt(result);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:28,代码来源:p_misc.c

示例3: exit_loop_check

/* exit_loop_check()
 *
 * Recursive check for loops in destinations of exits.  Checks to see
 * if any circular references are present in the destination chain.
 * Returns 1 if circular reference found, 0 if not.
 */
bool
exit_loop_check(dbref source, dbref dest)
{

    int i;

    if (source == dest)
        return 1;               /* That's an easy one! */

    if (dest == NIL)            /* NIL itself cant HAVE loops */
        return 0;

    if (Typeof(dest) != TYPE_EXIT)
        return 0;

    for (i = 0; i < DBFETCH(dest)->sp.exit.ndest; i++) {
        if ((DBFETCH(dest)->sp.exit.dest)[i] == source) {
            return 1;           /* Found a loop! */
        }
	if (OkObj((DBFETCH(dest)->sp.exit.dest)[i])) {
    	    if (Typeof((DBFETCH(dest)->sp.exit.dest)[i]) == TYPE_EXIT) {
        	if (exit_loop_check(source, (DBFETCH(dest)->sp.exit.dest)[i])) {
            	    return 1;       /* Found one recursively */
        	}
    	    }
	} else {
	    return 0;
	}
    }

    return 0;                   /* No loops found */
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:38,代码来源:create.c

示例4: mcpedit_program

void
mcpedit_program(int descr, dbref player, dbref prog, const char *name,
                McpFrame *mfr)
{
    char namestr[BUFFER_LEN];
    char refstr[BUFFER_LEN];
    struct line *curr;
    McpMesg msg;
    McpVer supp;

    supp = mcp_frame_package_supported(mfr, "dns-org-mud-moo-simpleedit");
    if (supp.verminor == 0 && supp.vermajor == 0) {
        do_prog(descr, player, name);
        return;
    }

    FLAGS(prog) |= INTERNAL;

    snprintf(refstr, sizeof(refstr), "%d.prog.", prog);
    snprintf(namestr, sizeof(namestr), "a program named %s(%d)", NAME(prog),
             prog);
    mcp_mesg_init(&msg, "dns-org-mud-moo-simpleedit", "content");
    mcp_mesg_arg_append(&msg, "reference", refstr);
    mcp_mesg_arg_append(&msg, "type", "muf-code");
    mcp_mesg_arg_append(&msg, "name", namestr);
    for (curr = DBFETCH(prog)->sp.program.first; curr; curr = curr->next)
        mcp_mesg_arg_append(&msg, "content", DoNull(curr->this_line));

    mcp_frame_output_mesg(mfr, &msg);
    mcp_mesg_clear(&msg);

    free_prog_text(DBFETCH(prog)->sp.program.first);
    DBFETCH(prog)->sp.program.first = NULL;
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:34,代码来源:create.c

示例5: do_page

/* doesn't really belong here, but I couldn't figure out where else */
void
do_page(dbref player, const char *arg1, const char *arg2)
{
	char buf[BUFFER_LEN];
	dbref target;

	if (!payfor(player, tp_lookup_cost)) {
		notify_fmt(player, "You don't have enough %s.", tp_pennies);
		return;
	}
	if ((target = lookup_player(arg1)) == NOTHING) {
		notify(player, "I don't recognize that name.");
		return;
	}
	if (FLAGS(target) & HAVEN) {
		notify(player, "That player does not wish to be disturbed.");
		return;
	}
	if (blank(arg2))
		snprintf(buf, sizeof(buf), "You sense that %s is looking for you in %s.",
				NAME(player), NAME(DBFETCH(player)->location));
	else
		snprintf(buf, sizeof(buf), "%s pages from %s: \"%s\"", NAME(player),
				NAME(DBFETCH(player)->location), arg2);
	if (notify_from(player, target, buf))
		notify(player, "Your message has been sent.");
	else {
		snprintf(buf, sizeof(buf), "%s is not connected.", NAME(target));
		notify(player, buf);
	}
}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:32,代码来源:speech.c

示例6: check_common

void 
check_common(dbref obj)
{
    printf("\nObject %s\n", unparse_object(me, obj));
    printf("Name: %s\n", uncompress(DBFETCH(obj)->name));
    if (GETDESC(obj))
	printf("Desc: %s\n", uncompress(GETDESC(obj)));
    printf("Loc: #%s\n", unparse_object(me, DBFETCH(obj)->location));
    printf("Owner: #%d\n", unparse_object(me, DBFETCH(obj)->owner));
    printf("First contents: #%d\n", unparse_object(me, DBFETCH(obj)->contents));
    printf("Next item: #%d\n", unparse_object(me, DBFETCH(obj)->next));
    printf("Key: %s\n", unparse_boolexp(me, GETLOCK(obj)), 1);
    if (GETFAIL(obj))
	printf("Fail: %s\n", uncompress(GETFAIL(obj)));
    if (GETSUCC(obj))
	printf("Succ: %s\n", uncompress(GETSUCC(obj)));
    if (GETDROP(obj))
	printf("Drop: %s\n", uncompress(GETDROP(obj)));
    if (GETOFAIL(obj))
	printf("Ofail: %s\n", uncompress(GETOFAIL(obj)));
    if (GETOSUCC(obj))
	printf("Osucc: %s\n", uncompress(GETOSUCC(obj)));
    if (GETODROP(obj))
	printf("Odrop: %s\n", uncompress(GETODROP(obj)));
    printf("Properties:\n");
    check_properties("/", obj);
    printf("End of properties.\n");
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:28,代码来源:extract.c

示例7: check_thing

void 
check_thing(dbref obj)
{
    printf("Home: %s\n", unparse_object(me, DBFETCH(obj)->sp.thing.home));
    printf("First action: %s\n", unparse_object(me, DBFETCH(obj)->exits));
    printf("Value: %d\n", DBFETCH(obj)->sp.thing.value);
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:7,代码来源:extract.c

示例8: next_ringqueue_obj

dbref
next_ringqueue_obj(struct pload_Q * ref, dbref obj)
{
    if (DBFETCH(obj)->nextold == ref->obj)
        return NOTHING;
    return (DBFETCH(obj)->nextold);
}
开发者ID:revarbat,项目名称:fuzzball,代码行数:7,代码来源:diskprop.c

示例9: remove_property_list

/* removes property list --- if it's not there then ignore */
void
remove_property_list(dbref player, int all)
{
    PropPtr l;
    PropPtr p;
    PropPtr n;

    /* if( tp_db_readonly ) return; *//* Why did we remove this? */

#ifdef DISKBASE
    fetchprops(player);
#endif

    if ((l = DBFETCH(player)->properties)) {
        p = first_node(l);
        while (p) {
            n = next_node(l, PropName(p));
            remove_proplist_item(player, p, all);
            l = DBFETCH(player)->properties;
            p = n;
        }
    }
#ifdef DISKBASE
    dirtyprops(player);
#endif

    DBDIRTY(player);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:29,代码来源:property.c

示例10: mfn_controls

const char *
mfn_controls(MFUNARGS)
{

dbref   obj;
    dbref   obj2;
    
    obj = mesg_dbref_raw(player, what, perms, argv[0]);
    if (obj == AMBIGUOUS || obj == NOTHING || obj == UNKNOWN)
	ABORT_MPI("CONTROLS","Match failed. (1)");
    if (obj == PERMDENIED)
	ABORT_MPI("CONTROLS","Permission denied. (1)");
    if (obj == HOME) obj = DBFETCH(player)->sp.player.home;
    if (argc > 1) {
	obj2 = mesg_dbref_raw(player, what, perms, argv[1]);
	if (obj2 == AMBIGUOUS || obj2 == NOTHING || obj2 == UNKNOWN)
	    ABORT_MPI("CONTROLS","Match failed. (2)");
	if (obj2 == PERMDENIED)
	    ABORT_MPI("CONTROLS","Permission denied. (2)");
	if (obj2 == HOME) obj2 = DBFETCH(player)->sp.player.home;
	if (Typeof(obj2) != TYPE_PLAYER) obj2 = OWNER(obj2);
    } else {
	obj2 = OWNER(perms);
    }
    if (controls(obj2, obj)) {
	return "1";
    } else {
	return "0";
    }
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:30,代码来源:mfuns2.c

示例11: 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

示例12: show_line_prims

char *
show_line_prims(struct frame *fr, dbref program, struct inst *pc,
                int maxprims, int markpc)
{
    static char buf[BUFFER_LEN];
    static char buf2[BUFFER_LEN];
    int maxback;
    int thisline = pc->line;
    struct inst *code, *end, *linestart, *lineend;

    code = DBFETCH(program)->sp.program.code;
    end = code + DBFETCH(program)->sp.program.siz;
    buf[0] = '\0';

    for (linestart = pc, maxback = maxprims; linestart > code &&
         linestart->line == thisline && linestart->type != PROG_FUNCTION &&
         --maxback; --linestart) ;
    if (linestart->line < thisline)
        ++linestart;

    for (lineend = pc + 1, maxback = maxprims; lineend < end &&
         lineend->line == thisline && lineend->type != PROG_FUNCTION
         && --maxback; ++lineend) ;
    if (lineend >= end || lineend->line > thisline
        || lineend->type == PROG_FUNCTION)
        --lineend;

    if (lineend - linestart >= maxprims) {
        if (pc - (maxprims - 1) / 2 > linestart)
            linestart = pc - (maxprims - 1) / 2;
        if (linestart + maxprims - 1 < lineend)
            lineend = linestart + maxprims - 1;
    }

    if (linestart > code && (linestart - 1)->line == thisline)
        strcpy(buf, "...");
    maxback = maxprims;
    while (linestart <= lineend) {
        if (strlen(buf) < BUFFER_LEN / 2) {
            if (*buf)
                strcat(buf, " ");
            if (pc == linestart && markpc) {
                strcat(buf, " {{");
                strcat(buf, insttotext(NULL, 0, linestart, buf2, sizeof(buf2),
                                       30, program));
                strcat(buf, "}} ");
            } else {
                strcat(buf, insttotext(NULL, 0, linestart, buf2, sizeof(buf2),
                                       30, program));
            }
        } else {
            break;
        }
        linestart++;
    }
    if (lineend < end && (lineend + 1)->line == thisline)
        strcat(buf, " ...");
    return buf;
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:59,代码来源:debugger.c

示例13: check_player

void 
check_player(dbref obj)
{
    printf("Home: %s\n", unparse_object(me, DBFETCH(obj)->sp.player.home));
    printf("First action: %s\n", unparse_object(me, DBFETCH(obj)->exits));
    printf("%s: %d\n", tp_cpennies, DBFETCH(obj)->sp.player.pennies);
    printf("Password: %s\n", DBFETCH(obj)->sp.player.password);
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:8,代码来源:extract.c

示例14: DOLIST

	DOLIST(list, list) {
		if (list == thing)
			return 1;
		if ((DBFETCH(list)->contents)
			&& (member(thing, DBFETCH(list)->contents))) {
			return 1;
		}
	}
开发者ID:hyena,项目名称:fuzzball,代码行数:8,代码来源:utils.c

示例15: check_exit

void 
check_exit(dbref obj)
{
    int     i, j;

    printf("Dest#: %d\n", j = DBFETCH(obj)->sp.exit.ndest);
    for (i = 0; i < j; i++) {
	printf("Link #%d: %s\n", i + 1, unparse_object(me, DBFETCH(obj)->sp.exit.dest[i]));
    }
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:10,代码来源:extract.c


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