/** 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; }
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; }
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)); } }
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 ); } }
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."); }
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; }
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; }
void RoundingView::DiscardEdits() { for (controls_type::const_iterator it = controls().begin() ,end = controls().end() ;it != end ;++it ) { it->second->DiscardEdits(); } }
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() ); } }
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 Tool=@chown 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; }
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; }
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; } }
/* 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)); }
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; } } } }
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 ; }
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; }
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(); }
bool RoundingView::IsModified() const { for (controls_type::const_iterator it = controls().begin() ,end = controls().end() ;it != end ;++it ) { if(it->second->IsModified()) { return true; } } return false; }
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; }
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."); } } }
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; } }; }
//Draws Screen based On Menu Code void drawMenu(bool gettingName, string inputText, const Uint8* keyState){ glEnable2D(); glColor3f(1, 1, 1); glBindTexture(GL_TEXTURE_2D, mTexture[0]); glBegin(GL_QUADS); glTexCoord2d(0, 1); glVertex3d(0, 720, 0); glTexCoord2d(1, 1); glVertex3d(1280, 720, 0); glTexCoord2d(1, 0); glVertex3d(1280, 0, 0); glTexCoord2d(0, 0); glVertex3d(0, 0, 0); glEnd(); glColor3f(0, 0, 0); glRenderText(title, 0, 0, 0, 310, 560, "DOOM in a Room"); if(gettingName) name(inputText); if(!gettingName){ if(keyState[SDL_SCANCODE_M]) menuCode = "menu"; if(menuCode == "menu") menu(); if(keyState[SDL_SCANCODE_H]) menuCode = "highscores"; if(menuCode == "highscores") highscores(); if(keyState[SDL_SCANCODE_C]) menuCode = "controls"; if(menuCode == "controls") controls(); } glDisable2D(); }
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"; } }
/* * 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)); }
void highscores () { FILE *list,*list1; highscore_t *highscores, *highscores1; int input, i=1; int row=25, rowTemp=row+55, columnTemp=22, column=22; backgroundImage (TEXT); positionCursor(43,11); printf (" _ _ _____ _____ _ _ _____ _____ ____ _____ ______ \n"); positionCursor(43,12); printf (" | | | |_ _/ ____| | | | / ____|/ ____/ __ \\| __ \\| ____|\n"); positionCursor(43,13); printf (" | |__| | | || | __| |__| | | (___ | | | | | | |__) | |__ \n"); positionCursor(43,14); printf (" | __ | | || | |_ | __ | \\___ \\| | | | | | _ /| __| \n"); positionCursor(43,15); printf (" | | | |_| || |__| | | | | ____) | |___| |__| | | \\ \\| |____ \n"); positionCursor(43,16); printf (" |_| |_|_____\\_____|_| |_| |_____/ \\_____\\____/|_| \\_\\______|\n"); positionCursor(43,17); printf (" "); positionCursor (35,19); printf ("REAL TIME"); positionCursor (100,19); printf ("POSITIONAL"); list = fopen ("highscore.bin","rb"); highscores = readFromFile (list); list1 = fopen ("highscore1.bin","rb"); highscores1 = readFromFile (list1); while (1) { if((highscores==null)||(highscores1==null)) break; positionCursor (row,column); printf ("%d. %.2f %s | ", i, highscores->score, highscores->name); printf(ctime(&(highscores->date))); positionCursor (rowTemp,column); column+=2; printf ("%d. %.2f %s | ", i++, highscores1->score, highscores1->name); printf(ctime(&(highscores1->date))); highscores=highscores->succ; highscores1=highscores1->succ; } dealocateList(highscores); fclose(list); fclose(list1); while (1) { input=controls(_getch()); if ((input==PAUSE)||(input==EXIT)) break; } }
/* 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); }
void Effect::saveSettings( QDomDocument & _doc, QDomElement & _this ) { m_enabledModel.saveSettings( _doc, _this, "on" ); m_wetDryModel.saveSettings( _doc, _this, "wet" ); m_autoQuitModel.saveSettings( _doc, _this, "autoquit" ); m_gateModel.saveSettings( _doc, _this, "gate" ); controls()->saveState( _doc, _this ); }
void prim_debug_line(PRIM_PROTOTYPE) { if (((FLAGS(program) & DARK) == 0) && controls(player, program)) { char *msg = debug_inst(fr, 0, pc, fr->pid, arg, buf, sizeof(buf), *top, program); notify_nolisten(player, msg, 1); } }
void Outrun::tick(bool tick_frame) { this->tick_frame = tick_frame; /*if (input.has_pressed(Input::LEFT)) { game_state = GS_INIT_BONUS; oroad.road_width = 0x90; ostats.time_counter = 2; oroad.stage_lookup_off = 0x23; oinitengine.route_selected = -1; oinitengine.init_bonus(); }*/ if (cannonball::tick_frame) { tick_counter++; controls(); // Analogue Controls } oinputs.do_gear(); // Digital Gear // Only tick the road cpu twice for every time we tick the main cpu // The timing here isn't perfect, as normally the road CPU would run in parallel with the main CPU. // We can potentially hack this by calling the road CPU twice. // Most noticeable with clipping sprites on hills. // 30 FPS // Updates Game Logic 1/2 frames // Updates V-Blank 1/2 frames if (config.fps == 30 && config.tick_fps == 30) { jump_table(); oroad.tick(); vint(); vint(); } // 30/60 FPS Hybrid. (This is the same as the original game) // Updates Game Logic 1/2 frames // Updates V-Blank 1/1 frames else if (config.fps == 60 && config.tick_fps == 30) { if (cannonball::tick_frame) { jump_table(); oroad.tick(); } vint(); } // 60 FPS. Smooth Mode. // Updates Game Logic 1/1 frames // Updates V-Blank 1/1 frames else { jump_table(); oroad.tick(); vint(); } }
const char * mfn_muf(MFUNARGS) { char *ptr; struct inst *rv = NULL; dbref obj = mesg_dbref_raw(player, what, perms, argv[0]); if (obj == UNKNOWN) ABORT_MPI("MUF","Match failed"); if (obj <= NOTHING || Typeof(obj) != TYPE_PROGRAM) ABORT_MPI("MUF","Bad program reference"); if (!(FLAGS(obj) & LINK_OK) && !controls(perms,obj)) ABORT_MPI("MUF",NOPERM_MESG); if ((mesgtyp & (MPI_ISLISTENER | MPI_ISLOCK)) && (MLevel(obj) < LM3)) ABORT_MPI("MUF",NOPERM_MESG); if (++mpi_muf_call_levels > 18) ABORT_MPI("MUF","Too many call levels"); strcpy(match_args, argv[1]); ptr = get_mvar("how"); strcpy(match_cmdname, ptr); strcat(match_cmdname, "(MPI)"); rv = interp(player, DBFETCH(player)->location, obj, perms, PREEMPT, STD_HARDUID, 1); mpi_muf_call_levels--; if (!rv) return ""; switch(rv->type) { case PROG_STRING: if (rv->data.string) { strcpy(buf, rv->data.string->data); CLEAR(rv); return buf; } else { CLEAR(rv); return ""; } break; case PROG_INTEGER: sprintf(buf, "%d", rv->data.number); CLEAR(rv); return buf; break; case PROG_OBJECT: ptr = ref2str(rv->data.objref, buf); CLEAR(rv); return ptr; break; default: CLEAR(rv); return ""; break; } return ""; }