• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ controls函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: first_visible

/** Return the first object near another object that is visible to a player.
 *
 * BEWARE:
 *
 * first_visible() does not behave as intended. It _should_ return the first
 * object in `thing' that is !DARK. However, because of the controls() check
 * the function will return a DARK object if the player owns it.
 *
 * The behavior is left as is because so many functions in fundb.c rely on
 * the incorrect behavior to return expected values. The lv*() functions
 * also make rewriting this fairly pointless.
 *
 * \param player the looker.
 * \param thing an object in the location to be inspected.
 * \return dbref of first visible object or NOTHING.
 */
dbref
first_visible(dbref player, dbref thing)
{
  int lck = 0;
  int ldark;
  dbref loc;

  if (!GoodObject(thing) || IsRoom(thing))
    return NOTHING;
  loc = IsExit(thing) ? Source(thing) : Location(thing);
  if (!GoodObject(loc))
    return NOTHING;
  ldark = IsPlayer(loc) ? Opaque(loc) : Dark(loc);

  while (GoodObject(thing)) {
    if (can_interact(thing, player, INTERACT_SEE, NULL)) {
      if (DarkLegal(thing) || (ldark && !Light(thing))) {
        if (!lck) {
          if (See_All(player) || (loc == player) || controls(player, loc))
            return thing;
          lck = 1;
        }
        if (controls(player, thing))    /* this is what causes DARK objects to show */
          return thing;
      } else {
        return thing;
      }
    }
    thing = Next(thing);
  }
  return thing;
}
开发者ID:zetafunction,项目名称:pennmush-mirror,代码行数:48,代码来源:predicat.c


示例2: control_process

int
control_process(dbref player, int pid)
{
	timequeue ptr = tqhead;

	while ((ptr) && (pid != ptr->eventnum)) {
		ptr = ptr->next;
	}

	/* If the process isn't in the timequeue, that means it's
		waiting for an event, so let the event code handle
		it. */

	if (!ptr) {
		return muf_event_controls(player, pid);
	}

	/* However, if it is in the timequeue, we have to handle it.
		Other than a Wizard, there are three people who can kill it:
		the owner of the program, the owner of the trigger, and the
		person who is currently running it. */

	if (!controls(player, ptr->called_prog) && !controls(player, ptr->trig)
			&& (player != ptr->uid)) {
		return 0;
	}
	return 1;
}
开发者ID:hyena,项目名称:fuzzball,代码行数:28,代码来源:timequeue.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: getView

void TOOL_BASE::updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads )
{
    int tl = getView()->GetTopLayer();
    VECTOR2I cp = controls()->GetCursorPosition( !aEvent.Modifier( MD_SHIFT ) );
    VECTOR2I p;

    controls()->ForceCursorPosition( false );
    m_gridHelper->SetUseGrid( !aEvent.Modifier( MD_ALT ) );
    m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) );

    bool snapEnabled = true;

    if( aEvent.IsMotion() || aEvent.IsClick() )
    {
        snapEnabled = !aEvent.Modifier( MD_SHIFT );
        p = aEvent.Position();
    }
    else
    {
        p = cp;
    }

    m_startItem = pickSingleItem( p, -1, -1, aIgnorePads );

    if( !snapEnabled && m_startItem && !m_startItem->Layers().Overlaps( tl ) )
        m_startItem = nullptr;

    m_startSnapPoint = snapToItem( snapEnabled, m_startItem, p );

    if( checkSnap( m_startItem ) )
    {
        controls()->ForceCursorPosition( true, m_startSnapPoint );
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:34,代码来源:pns_tool_base.cpp


示例5: link_exit

static void 
link_exit(dbref player, dbref exit, dbref dest, int key)
{
    int cost, quot;

    /* Make sure we can link there */

    if ((dest != HOME) &&
	((!controls(player, dest) && !Link_ok(dest)) ||
	 !could_doit(player, dest, A_LLINK, 1, 0))) {
	notify_quiet(player, "Permission denied.");
	return;
    }
    /* Exit must be unlinked or controlled by you */

    if ((Location(exit) != NOTHING) && !controls(player, exit)) {
	notify_quiet(player, "Permission denied.");
	return;
    }
    /* If exit is unlinked and mudconf 'paranoid_exit_linking' is enabled
     * Do not allow the exit to be linked if you do not control it
     */
    if ( (mudconf.paranoid_exit_linking == 1) && !controls(player,exit) ) {
        notify_quiet(player, "Permission denied.");
	return;
    }

    /* handle costs */

    cost = mudconf.linkcost;
    quot = 0;
    if (Owner(exit) != Owner(player)) {
	cost += mudconf.opencost;
	quot += mudconf.exit_quota;
    }
    if (!canpayfees(player, player, cost, quot, TYPE_EXIT))
	return;

    /* Pay the owner for his loss */

    /* Ok, if paranoid_exit_linking is enabled the linker does NOT own exit */
    if (!(mudconf.paranoid_exit_linking)) {
       if (Owner(exit) != Owner(player)) {
	   giveto(Owner(exit), mudconf.opencost, NOTHING);
	   add_quota(Owner(exit), quot, TYPE_EXIT);
	   s_Owner(exit, Owner(player));
	   s_Flags(exit, (Flags(exit) & ~(INHERIT | WIZARD)) | HALT);
       }
    }
    /* link has been validated and paid for, do it and tell the player */

    s_Location(exit, dest);
    if (!(Quiet(player) || (key & SIDEEFFECT)) )
	notify_quiet(player, "Linked.");
}
开发者ID:pdbogen,项目名称:RhostMUSH,代码行数:55,代码来源:create.c


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


示例7: mfn_contents

const char *
mfn_contents(MFUNARGS)
{
    char buf2[50];
    int list_limit = MAX_MFUN_LIST_LEN;
    dbref obj = mesg_dbref_local(player, what, perms, argv[0]);
    int typchk, ownroom;
    int outlen, nextlen;

    if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
	ABORT_MPI("CONTENTS","Match failed");
    if (obj == PERMDENIED)
	ABORT_MPI("CONTENTS",NOPERM_MESG);

    typchk = NOTYPE;
    if (argc > 1) {
	if (!string_compare(argv[1], "Room")) {
	    typchk = TYPE_ROOM;
	} else if (!string_compare(argv[1], "Exit")) {
	    typchk = TYPE_EXIT;  /* won't find any, though */
	} else if (!string_compare(argv[1], "Player")) {
	    typchk = TYPE_PLAYER;
	} else if (!string_compare(argv[1], "Program")) {
	    typchk = TYPE_PROGRAM;
	} else if (!string_compare(argv[1], "Thing")) {
	    typchk = TYPE_THING;
	} else {
	    ABORT_MPI("CONTENTS","Type must be 'player', 'room', 'thing', 'program', or 'exit'. (2)");
	}
    }
    strcpy(buf, "");
    outlen = 0;
    ownroom = controls(perms, obj);
    obj = DBFETCH(obj)->contents;
    while (obj != NOTHING && list_limit) {
	if ((typchk == NOTYPE || Typeof(obj) == typchk) &&
		(ownroom || controls(perms, obj) ||
		!((FLAGS(obj) & DARK) || (FLAGS(getloc(obj)) & DARK) ||
		(Typeof(obj) == TYPE_PROGRAM && !(FLAGS(obj) & LINK_OK)))) &&
		!(Typeof(obj) == TYPE_ROOM && typchk != TYPE_ROOM)) {
	    ref2str(obj, buf2);
	    nextlen = strlen(buf2);
	    if ((outlen + nextlen) >= (BUFFER_LEN - 3))
		break;
	    if (outlen) strcat((buf+(outlen++)), "\r");
	    strcat((buf + outlen), buf2);
	    outlen += nextlen;
	    list_limit--;
	}
	obj = DBFETCH(obj)->next;
    }
    return buf;
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:53,代码来源:mfuns2.c


示例8: controls

void RoundingView::DiscardEdits()
{
    for
        (controls_type::const_iterator it = controls().begin()
        ,end = controls().end()
        ;it != end
        ;++it
        )
        {
        it->second->DiscardEdits();
        }
}
开发者ID:vadz,项目名称:lmi.new,代码行数:12,代码来源:rounding_view.cpp


示例9: controls

void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent )
{
    int layer;
    bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
    m_gridHelper->SetUseGrid( !aEvent.Modifier( MD_ALT ) );
    m_gridHelper->SetSnap( snapEnabled );

    controls()->ForceCursorPosition( false );
    VECTOR2I mousePos = controls()->GetMousePosition();

    if( m_router->Settings().Mode() != RM_MarkObstacles &&
        ( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 ) )
    {
        m_endSnapPoint = snapToItem( snapEnabled, nullptr, mousePos );
        controls()->ForceCursorPosition( true, m_endSnapPoint );
        m_endItem = nullptr;

        return;
    }

    if( m_router->IsPlacingVia() )
        layer = -1;
    else
        layer = m_router->GetCurrentLayer();

    ITEM* endItem = nullptr;

    std::vector<int> nets = m_router->GetCurrentNets();

    for( int net : nets )
    {
        endItem = pickSingleItem( mousePos, net, layer, false, { m_startItem } );

        if( endItem )
            break;
    }

    if( checkSnap( endItem ) )
    {
        m_endItem = endItem;
        m_endSnapPoint = snapToItem( snapEnabled, endItem, mousePos );
    } else {
        m_endItem = nullptr;
        m_endSnapPoint = m_gridHelper->Align( mousePos );
    }

    controls()->ForceCursorPosition( true, m_endSnapPoint );

    if( m_endItem )
    {
        wxLogTrace( "PNS", "%s, layer : %d", m_endItem->KindStr().c_str(), m_endItem->Layers().Start() );
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:53,代码来源:pns_tool_base.cpp


示例10: chown_ok

static int
chown_ok(dbref player, dbref thing, dbref newowner, NEW_PE_INFO *pe_info)
{
  /* Can't touch garbage */
  if (IsGarbage(thing))
    return 0;

  /* Wizards can do it all */
  if (Wizard(player))
    return 1;

  /* In order for non-wiz player to @chown thing to newowner,
   * player must control newowner or newowner must be a Zone Master
   * and player must pass its zone lock.
   *
   * In addition, one of the following must apply:
   *   1.  player owns thing, or
   *   2.  player controls Owner(thing), newowner is a zone master,
   *       and Owner(thing) passes newowner's zone-lock, or
   *   3.  thing is CHOWN_OK, and player holds thing if it's an object.
   *
   * The third condition is syntactic sugar to handle the situation
   * where Joe owns Box, an ordinary object, and Tool, an inherit object,
   * and ZMP, a Zone Master Player, is zone-locked to =tool.
   * In this case, if Joe doesn't pass ZMP's lock, we don't want
   *   Joe to be able to @fo [email protected] Box=ZMP
   */

  /* Does player control newowner, or is newowner a Zone Master and player
   * passes the lock?
   */
  if (!(controls(player, newowner) ||
        (ZMaster(newowner) &&
         eval_lock_with(player, newowner, Zone_Lock, pe_info))))
    return 0;

  /* Target player is legitimate. Does player control the object? */
  if (Owns(player, thing))
    return 1;

  if (controls(player, Owner(thing)) && ZMaster(newowner) &&
      eval_lock_with(Owner(thing), newowner, Zone_Lock, pe_info))
    return 1;

  if ((!IsThing(thing) || (Location(thing) == player)) && ChownOk(thing) &&
      eval_lock_with(player, thing, Chown_Lock, pe_info))
    return 1;

  return 0;
}
开发者ID:captdeaf,项目名称:pennmush,代码行数:50,代码来源:set.c


示例11: can_link_to

bool
can_link_to(dbref who, object_flag_type what_type,
            dbref where)
{
    if (where == HOME)
        return 1;

    if (where == NIL)
        return 1;

    if (!OkObj(who) || !OkObj(where))
        return 0;

    switch (what_type) {
        case TYPE_EXIT:
            return (controls(who, where) || (FLAGS(where) & LINK_OK)
                    || (POWERS(who) & POW_LINK_ANYWHERE));
            /* NOTREACHED */
            break;
        case TYPE_PLAYER:
            return (Typeof(where) == TYPE_ROOM && (controls(who, where)
                                                   || Linkable(where)
                                                   || (POWERS(who) &
                                                       POW_LINK_ANYWHERE)));
            /* NOTREACHED */
            break;
        case TYPE_ROOM:
            return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_THING)
                    && (controls(who, where) || Linkable(where)
                        || (POWERS(who) & POW_LINK_ANYWHERE)));
            /* NOTREACHED */
            break;
        case TYPE_THING:
            return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_PLAYER
                     || Typeof(where) == TYPE_THING)
                    && (controls(who, where) || Linkable(where)
                        || (POWERS(who) & POW_LINK_ANYWHERE)));
            /* NOTREACHED */
            break;
        case NOTYPE:
            return (controls(who, where) || (FLAGS(where) & LINK_OK)
                    || (POWERS(who) & POW_LINK_ANYWHERE)
                    || (Typeof(where) != TYPE_THING && (FLAGS(where) & ABODE)));
            /* NOTREACHED */
            break;
    }

    return 0;
}
开发者ID:nekosune,项目名称:protomuck,代码行数:49,代码来源:predicates.c


示例12: menu

void menu()
{
    char choice;
    begin:
    initMenu();
    settextstyle(GOTHIC_FONT, HORIZ_DIR, 4);
    outtextxy(getmaxx()/2-45, top+5, "MENU");
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 1.75);
    outtextxy(getmaxx()/2-75, top+60, "1. START");
    outtextxy(getmaxx()/2-75, top+75, "2. HIGH SCORE");
    outtextxy(getmaxx()/2-75, top+90, "3. CONTROLS");
    outtextxy(getmaxx()/2-75, top+105, "4. EXIT");
    error1:
    choice=getch();
    switch(choice)
    {
	case '1' : level();
		   return;
	case '2' : disHighscore();
		   goto begin;
    case '3' : controls();
	       goto begin;
	case '4' : closegraph();
		   exit(0);
	default  : goto error1;
    }
}
开发者ID:mintoo511,项目名称:Tetris-in-C,代码行数:27,代码来源:TETRIS.C


示例13: can_link

/* This checks to see if what can be linked to something else by who. */
int
can_link(dbref who, dbref what)
{
	/* Anyone can link an exit that is currently unlinked. */
	return (controls(who, what) || ((Typeof(what) == TYPE_EXIT)
									&& DBFETCH(what)->sp.exit.ndest == 0));
}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:8,代码来源:predicates.c


示例14: main

int main() {

	// do setup 
	setup();
	
	DDRC |= (1 << PC5);
	PORTC &= ~(1 << PC5);

/*
	// wait until all buttons released
	uint8_t waitbutton = ~(PIND) & 0b00011111;
	if (~(PINB) & (1<<PB0)) waitbutton |= 0b00100000; // pridame edit tlacitko z portu B
	while (waitbutton) {
		waitbutton = ~(PIND) & 0b00011111;
		if (~(PINB) & (1<<PB0)) waitbutton |= 0b00100000; // pridame edit tlacitko z portu B
	}
*/

	// and go for infinite loop
	for (;;) {
		
		controls();		// read buttons and pots
		lights();		// compute which LED to light up
		
		if (newstep) {
			newstep = 0;
			uint8_t i;
			for (i = 0; i < 4; i++) {
				if (seq[playstep] & (1 << i)) gate[i] = 1;			
			}
		}
	}
}
开发者ID:hadesbox,项目名称:lunchbeat-PCB,代码行数:33,代码来源:lunchbeat-pcb.c


示例15: main

int main() {
	char ch;
	welcomescreen();	
	printrule();	
	do {
		switch(mainmenu()) {
			case 0 :loadgame();
				break;
			case 1: controls();
				break;
			case 2: ;
				break;
		
			}
	
		printf("\nDo you want to play now ? ( Y OR N)\n");
		scanf("%c",&ch);
		ch = tolower(ch);	
	} while(ch =='y');
		
	clrscr();
	printf("Your score has been saved to Snake.txt\n");
	FILE *fp;
	fp = fopen("Snake.txt", "a");
	fprintf(fp,"Player score : %d\n", globscore);	
	printf("\n\nThanks for playing\n");
	fclose(fp);
return 0 ;

}		
开发者ID:shantanuusharma,项目名称:Project,代码行数:30,代码来源:snake.c


示例16: cases

		double Auc::auc(const std::vector<double> &propensityScores, const std::vector<int> &treatment) {
			unsigned int m = 0;
			for (unsigned int i = 0; i < treatment.size(); i++) {
				if (treatment.at(i) == 1) {
					m++;
				}
			}
			unsigned int n = treatment.size() - m;
      std::vector<double> cases(m);
			std::vector<double> controls(n);
			m = 0;
			n = 0;
			for (unsigned int i = 0; i < treatment.size(); i++) {
				if (treatment.at(i) == 1) {
					cases[m++] = propensityScores.at(i);
				} else {
					controls[n++] = propensityScores.at(i);
				}
			}
			double mean = 0;
			for (unsigned int i = 0; i < m; i++) {
        double localMean = 0;
				for (unsigned int j = 0; j < n; j++) {
					double mw = mannWhitneyKernel(cases.at(i), controls.at(j));
					localMean += mw;
				}
        mean += localMean / n;
			}
			mean /= m;
			return mean;
		}
开发者ID:anthonysena,项目名称:CohortMethod,代码行数:31,代码来源:Auc.cpp


示例17: main

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	QDesktopWidget desktop;
	QRectF screenRect = desktop.availableGeometry();

	Controles controls(DEFAULT_WIDTH, DEFAULT_ITER_MAX);
	Processeur processor(DEFAULT_WIDTH, DEFAULT_ITER_MAX);
	Widget w;

	QObject::connect(&controls, &Controles::SignalWidthChanged, &processor, &Processeur::SlotSetWidth);
	QObject::connect(&controls, &Controles::SignalPlay, &processor, &Processeur::SlotStartAnim);
	QObject::connect(&controls, &Controles::SignalPause, &processor, &Processeur::SlotStopAnim);
	QObject::connect(&controls, &Controles::SignalIterationMaxChanged, &processor, &Processeur::SlotSetMaxValue);
	QObject::connect(&processor, &Processeur::SignalDataChanged, &w, &Widget::SlotUpdateLines);

	w.resize(800, 800);
	controls.show();
	w.show();

	controls.move(screenRect.width()/2 - (controls.frameSize().width()+w.frameSize().width())/2, 50);
	w.move(controls.x()+controls.frameSize().width(), 50);

	QObject::connect(&a, &QGuiApplication::lastWindowClosed, &QCoreApplication::quit);

	return a.exec();
}
开发者ID:D-BookeR,项目名称:Creer_des_applications_avec_Qt5,代码行数:28,代码来源:main.cpp


示例18: StringArray

StringArray MainMenuModel::getMenuBarNames()
{

    //OLD METHOD - caused an assertion when trying to display non-standard characters (e.g. japanese characters)
    /*
    //const char* const names[] = { file.toUTF8(), edit.toUTF8(), options.toUTF8(), controls.toUTF8(), help.toUTF8(), 0 };
    const char* const names[] = { "File", "Edit", "Options", "Controls", "Help", 0 };
    return StringArray ((const char**) names);
     */
    
    StringArray names;
    
    String file(translate("File"));
    String edit(translate("Edit"));
    String view(translate("View"));
    String options(translate("Options"));
    String controls(translate("Controls"));
    String hardware(translate("Hardware"));
    String help(translate("Help"));
    
    names.add(file);
    names.add(edit);
    names.add(view);
    names.add(options);
    names.add(controls);
    names.add(hardware);
    names.add(help);
    
    return names;
}
开发者ID:ankit--sethi,项目名称:AlphaLive,代码行数:30,代码来源:MainMenuModel.cpp


示例19: open_exit

static void 
open_exit(dbref player, dbref loc, char *direction, char *linkto, int key)
{
    dbref exit;
    char *tpr_buff, *tprp_buff;

    if (!Good_obj(loc))
	return;

    if (!direction || !*direction) {
	notify_quiet(player, "Open where?");
	return;
    } else if (!controls(player, loc) && !could_doit(player, loc, A_LOPEN, 0, 0)) {
	notify_quiet(player, "Permission denied.");
	return;
    }
    exit = create_obj(player, TYPE_EXIT, direction, 0);
    if (exit == NOTHING)
	return;

    /* Initialize everything and link it in. */

    s_Exits(exit, loc);
    s_Next(exit, Exits(loc));
    s_Exits(loc, exit);

    /* and we're done */

    if ( !(key & SIDEEFFECT ) )
       notify_quiet(player, "Opened.");

    /* See if we should do a link */

    if (!linkto || !*linkto)
	return;

    loc = parse_linkable_room(player, linkto);
    if (loc != NOTHING) {

	/* Make sure the player passes the link lock */

	if ((loc != HOME) && !could_doit(player, loc, A_LLINK, 1, 0)) {
	    notify_quiet(player, "You can't link to there.");
	    return;
	}
	/* Link it if the player can pay for it */

	if (!payfor(player, mudconf.linkcost)) {
            tprp_buff = tpr_buff = alloc_lbuf("open_exit");
	    notify_quiet(player,
			 safe_tprintf(tpr_buff, &tprp_buff, "You don't have enough %s to link.",
				 mudconf.many_coins));
            free_lbuf(tpr_buff);
	} else {
	    s_Location(exit, loc);
	    if ( !(key & SIDEEFFECT ) )
	       notify_quiet(player, "Linked.");
	}
    }
}
开发者ID:pdbogen,项目名称:RhostMUSH,代码行数:60,代码来源:create.c


示例20: main

void main(void) {
	// Clear Screen
	cpct_memset(SCR_VMEM, 0, 0x4000);
	initCPC();
	gameScene=CALIVGAMESSCREEN;
	//gameScene=MENUSCREEN;
	// Loop forever
	while (1) {
		switch (gameScene) {
		    case CALIVGAMESSCREEN: calivGames();
				break;
			case MENUSCREEN: mainMenu();
				break;
			case PLAYGAMESCREEN: infinityMode();
				break;
    		case NEXTLEVELSCREEN: newLevel();
	    		break;
			case CONTROLSSCREEN: controls();
				break;
		    case GAMEOVERSCREEN: gameOver();
				break;
			case CREDITSSCEENE: credits();
				break;
		}
	};
}
开发者ID:CalivmaInnovation,项目名称:FlyBoard,代码行数:26,代码来源:main.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ conv函数代码示例发布时间:2022-05-30
下一篇:
C++ control函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap