コード例 #1
0
ファイル: adl_v2.cpp プロジェクト: WinterGrascph/scummvm
void AdlEngine_v2::checkTextOverflow(char c) {
	if (c != APPLECHAR('\r'))
		return;

	++_linesPrinted;

	if (_linesPrinted < 4)
		return;

	_linesPrinted = 0;
	_display->updateTextScreen();
	bell();

	while (true) {
		char key = inputKey(false);

		if (shouldQuit())
			return;

		if (key == APPLECHAR('\r'))
			break;

		bell(3);
	}
}
コード例 #2
0
ファイル: ui-object.c プロジェクト: angband/angband
/**
 * Deal with events on the get_item menu
 */
bool get_item_action(struct menu *menu, const ui_event *event, int oid)
{
	struct object_menu_data *choice = menu_priv(menu);
	char key = event->key.code;
	bool is_harmless = item_mode & IS_HARMLESS ? true : false;
	int mode = OPT(player, rogue_like_commands) ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG;

	if (event->type == EVT_SELECT) {
		if (get_item_allow(choice[oid].object, cmd_lookup_key(item_cmd, mode),
						   item_cmd, is_harmless))
			selection = choice[oid].object;
	}

	if (event->type == EVT_KBRD) {
		if (key == '/') {
			/* Toggle if allowed */
			if (((item_mode & USE_INVEN) || allow_all)
				&& (player->upkeep->command_wrk != USE_INVEN)) {
				player->upkeep->command_wrk = USE_INVEN;
				newmenu = true;
			} else if (((item_mode & USE_EQUIP) || allow_all) &&
					   (player->upkeep->command_wrk != USE_EQUIP)) {
				player->upkeep->command_wrk = USE_EQUIP;
				newmenu = true;
			} else {
				bell("Cannot switch item selector!");
			}
		}

		else if (key == '|') {
			/* No toggle allowed */
			if ((q1 > q2) && !allow_all){
				bell("Cannot select quiver!");
			} else {
				/* Toggle to quiver */
				player->upkeep->command_wrk = (USE_QUIVER);
				newmenu = true;
			}
		}

		else if (key == '-') {
			/* No toggle allowed */
			if ((f1 > f2) && !allow_all) {
				bell("Cannot select floor!");
			} else {
				/* Toggle to floor */
				player->upkeep->command_wrk = (USE_FLOOR);
				newmenu = true;
			}
		}
	}

	return false;
}
コード例 #3
0
ファイル: seqed_search.c プロジェクト: svn2github/staden
int seqed_next_string(tkSeqed *se,
		      int direction)
{
    int i;

    /* find first match after current cursor position */
    if (direction == 0) {
	/* moved cursor so need to find nearest match */
	if (prev_cursor_pos != se->cursorPos) {
	    current_match = n_matches;
	    for (i = 0; i < n_matches; i++) {
		if (pos[i] >= se->cursorPos) {
		    current_match = i;
		    break;
		}
	    }
	} else {
	    current_match++;
	}
    } else {
	/* reverse search */
	/* moved cursor so need to find nearest match */
	if (prev_cursor_pos != se->cursorPos) {
	    current_match = -1;
	    for (i = n_matches-1; i > 0; i--) {
		if (pos[i] <= se->cursorPos) {
		    current_match = i;
		    break;
		}
	    }
	} else {
	    current_match--;
	}
    }

    if (current_match < 0) {
	bell();
	current_match = 0;
	return -1;
    }

    if (current_match >= n_matches) {
	bell();
	current_match = n_matches - 1;
	return -1;
    }

    seqed_setCursorPos(se, pos[current_match]);
    seqed_showCursor(se, se->cursorSeq, pos[current_match]); 
    prev_cursor_pos = se->cursorPos;
    return 0;
}
コード例 #4
0
ファイル: undo.c プロジェクト: nathanhaigh/staden-trunk
void undoLastCommand(EdStruct *xx)
/*
 * Undo last keypress 
 */
{
    UndoStruct *u;
    
    if (xx->editorState == StateDown)
	return;

    if (DBI_num_undo(xx) == 0) {
	/* no undo available */
	bell();
	return;
    }
    
    u = DBI_undo_lists(xx)[DBI_last_undo(xx)];

    if (u == NULL || !(_DBI_flags(u->db) & DB_ACCESS_UPDATE)) {
	bell();
	return;
    }

    if (--DBI_edits_made(xx) < 0) {
	DBI_edits_made(xx) = 0;
	DBI_since_auto_save(xx) = 1;
    }
    
    while ( u != NULL ) {
	/* fprintf(stderr, "Undoing edit on db %p\n", u->db); */
	/* DumpUndo(u); */
	undoEdit(u);
	u = u->next;
    }
    
    
    /* remove last undo */
    freeUndoList(DBI_undo_lists(xx)[DBI_last_undo(xx)],FREE_UNDO);
    DBI_undo_lists(xx)[DBI_last_undo(xx)] = NULL;
    DBI_last_undo(xx) = (DBI_last_undo(xx) + MAX_SAVE_EDITS - 1) %
	MAX_SAVE_EDITS;
    DBI_num_undo(xx)--;

#ifdef CACHE_CONSENSUS_2
    /* Update consensus buffers */
    invalidate_consensus(xx);
#endif

    /* Not optimal, but works */
    xx->refresh_flags = ED_DISP_ALL;
    redisplayWithCursor(xx);
}
コード例 #5
0
ファイル: tman_display.c プロジェクト: svn2github/staden
void diffTrace(edview *xx, char *path1, char *path2) {
    signed int t1 = -1, t2 = -1;
    tman_dc *edc1, *edc2;
    int i;

    /*
     * Ensure that we've got a blank trace slot available. Not doing this may
     * cause the traces to be shuffled up when we bring up the differences,
     * which due to the use of edc pointers causes confusion.
     */
    for (i = 0; i < MAXCONTEXTS; i++) {
	if (context_list[i] == -1)
	    break;
    }
    if (i == MAXCONTEXTS)
	deleteTraceDisplay(xx, &contexts[context_list[0]]);

    for (i = 0; i < MAXCONTEXTS; i++) {
	if (context_list[i] >= 0 &&
	    strncmp(contexts[context_list[i]].path, path1, 1024) == 0) {
	    t1 = i;
	    if (t2 != -1)
		break;
	}

	if (context_list[i] >= 0 &&
	    strncmp(contexts[context_list[i]].path, path2, 1024) == 0) {
	    t2 = i;
	    if (t1 != -1)
		break;
	}
    }

    if (t1 == -1 || t2 == -1 || t1 == t2) {
	bell();
	return;
    }

    if (NULL == (edc1 = find_edc(&contexts[context_list[t1]])) ||
	NULL == (edc2 = find_edc(&contexts[context_list[t2]]))) {
	bell();
	return;
    }

    if (edc1->xx->cnum != edc2->xx->cnum) {
	bell();
	return;
    }

    diff_edc_traces(xx, edc1, edc2);
}
コード例 #6
0
ファイル: select.c プロジェクト: marvelliu/lilacsrc
static void select_wrong(struct _select_def *conf)
{
    if (conf->flag & LF_BELL) {
        bell();
        oflush();
    }
}
コード例 #7
0
ファイル: display.c プロジェクト: mingpen/OpenNT
/*** printerror - print error message on status line
*
*  prints a formatted error message on the status line, and then waits for a
*  keystroke. Once hit, the message is cleared.
*
* Input:
*  printf style parameters
*
* Output:
*  Number of characters output in error message
*
*************************************************************************/
int
printerror (
    char *pszFmt,
    ...
    ) {

    buffer       bufLocal;
    va_list      Arguments;
    REGISTER int cch;

    va_start(Arguments, pszFmt);

    ZFormat (bufLocal, pszFmt, Arguments);

    fReDraw = TRUE;
    bell ();
    FlushInput ();
    cch = soutb (0, YSIZE, bufLocal, errColor);
    if (fErrPrompt) {
		asserte (*GetMsg (MSG_PRESS_ANY, bufLocal));
        soutb (XSIZE-strlen(bufLocal)-1, YSIZE, bufLocal, errColor);
        SetEvent( semIdle );
		ReadChar ();
        WaitForSingleObject(semIdle, INFINITE);
		bufLocal[0] = ' ';
		bufLocal[1] = '\0';
		soutb(0, YSIZE, bufLocal, errColor);
    }

    va_end(Arguments);

    return cch;
}
コード例 #8
0
ファイル: h19.cpp プロジェクト: mgarlanger/VirtualH89
/// \brief Process transmit page
///
void
H19::transmitPage()
{
    transmitLines(0, rowsMain_c - 1);
    sendData(ascii::CR);
    bell();
}
コード例 #9
0
ファイル: GAME.CPP プロジェクト: akreddysoft/CollegeCode
/* The main function body of main screen which displays the main screen
creating the opening screen display */
mainscreen()
{
	int maxx, maxy, in, area;

	// get maximum x, y coordinates of the screen
	maxx = getmaxx();
	maxy = getmaxy();

	// setbkcolor sets the current background color using the palette
	setbkcolor(RED);

	// Draws a rectangle (graphics mode)
	rectangle(0, 0, maxx, maxy);

	// sets the line style and text justification in screen
	changetextstyle(1,0,0);

	// displaying the output text on main screen
	outtextxy(220, 20, "WELCOME");
	outtextxy(240,60,"	  TO ");
	outtextxy(220,100," BRICKS");
	changetextstyle(7, HORIZ_DIR, 3);
	bell(3);
	outtextxy(110, 150, "Press any key to continue...");

	// Flushes the standard input device
	fflush(stdin);
	getch();
	closegraph();

}
コード例 #10
0
ファイル: RUN.C プロジェクト: PrincipiaCollege/RSC
int get_input(double *val) {
  BOOLEAN inbounds = TRUE;
  char input_str[MAX_FIELD] = "";
  int return_val;
  mouse_stat mouse_tel;   // mouse telemetry record

  bell();
  set_keyboard_color(BLACK, GREEN);
  input_monitor();

  // loop until they hit ESC or they type in a decent value
  do {
    return_val = map_string(
      66, 18, WHITE, BLUE, BLACK, LIGHTGRAY, MAX_FIELD, &mouse_tel,
      input_str, 0
    );

    // THF patch
    if (sscanf(input_str, "%lf", val) == 0) {
      err_message("Incorrect input.  Please try again.");
      inbounds = FALSE;
    } else {
      if(*val < 100000.0 && *val > -10000.0) {
        inbounds = TRUE;
      } else {
        inbounds = FALSE;
        err_message("Input out of bounds.");
      }
    }
  } while((return_val != EscKey) && (inbounds == FALSE));

  set_keyboard_color(BLACK, LIGHTGRAY);
  clear_monitor();
  return return_val;
}
コード例 #11
0
ファイル: main.cpp プロジェクト: ltf1320/programdesign
void pre()
{
    for(int i=0;i<MOD;i++)
    {
        bell(i);
    }
}
コード例 #12
0
ファイル: c_users.c プロジェクト: catskillmarina/eBBS
/*ARGSUSED*/
AllUsersFunc( int indx, ACCOUNT *acct, struct enum_info *info )
{
  if (info->topline == info->currline) {
    move(info->topline-1, 0);
    prints("%-14s %-30s   %s\n","User Id", "User Name", "Last Login");
  }

  prints("%-14s %-30s %c %s", acct->userid, acct->username,
   BITISSET(acct->flags, FLG_EXEMPT) ? 'X': ' ',
   (acct->lastlogin == 0) ? "\n":ctime((time_t *)&acct->lastlogin));

  info->currline++;
  info->count++;

  if (info->currline > info->bottomline) {
    int ch;
    standout();
    prints("--MORE--");
    standend();
    clrtoeol();
    while((ch = igetch()) != EOF) {
      if(ch == '\n' || ch == '\r' || ch == ' ')
	break;
      if(toupper(ch) == 'Q') {
	move(info->currline, 0);
	clrtoeol();
	return ENUM_QUIT;
      }
      else bell();
    }
    info->currline = info->topline;
  }
  return S_OK;
}
コード例 #13
0
ファイル: cfmt.c プロジェクト: wjlei1990/WORKFLOW
/** 
 * Format and send a error message containing the current command
 * 
 * @param kmsg2 
 *    Second line of error message with a "$" appended to it
 *    A point to the bad token will be added to this line.
 *    The first line will contain a standard error message 
 *    with the current command appended to it.
 * @param kmsg2_s 
 *    Length of \p kmsg2
 *
 * @date   820615:  Added call to CERR to set error condition.
 * @date   820420:  Original version.
 *
 */
void 
cfmt(char *kmsg2, 
     int   kmsg2_s) {

	static char kmsg1[28] = "ERROR interpreting command:";

	/* - Raise command syntax error condition. */
	cerr( 1001 );
  
  char *s = strcut(kmsg2, 1, indexb(kmsg2, kmsg2_s));
  bell();
  fprintf(stdout, " %s  %s \n", kmsg1, lexer_input());
  if(arg()) {
    fprintf(stdout, " %*s  %*s\n", -(int)strlen(kmsg1), s, arg()->col, "^");
  } else {
    fprintf(stdout, " %*s  %*s\n", -(int)strlen(kmsg1), s, (int)strlen(lexer_input()), "^");
  }
  
  FREE(s);

  return;

	return;

} /* end of function */
コード例 #14
0
ファイル: button.c プロジェクト: blubaron/z-angband
/*
 * Add a button
 */
int button_add_1d_text(const char *label, char keypress)
{
	int i;
	int length = strlen(label);

	/* Check the label length */
	if (length > MAX_MOUSE_LABEL)
	{
		bell("Label too long - button abandoned!");
		return 0;
	}

	/* Check we haven't already got a button for this keypress */
	for (i = 0; i < button_1d_num; i++)
		if (button_1d_list[i].key == keypress)
			return 0;

	/* Make the button */
	button_1d_length += length;
	my_strcpy(button_1d_list[button_1d_num].label, label, MAX_MOUSE_LABEL);
	button_1d_list[button_1d_num].left = button_1d_length - length + 1;
	button_1d_list[button_1d_num].right = button_1d_length;
	button_1d_list[button_1d_num++].key = keypress;

	/* Redraw */
	p_ptr->redraw |= (PR_BUTTONS);

	/* Return the size of the button */
	return (length);
}
コード例 #15
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
int putch(int c)
{
  int     row, col;

  ScreenGetCursor(&row, &col);

  /*  first, handle the character */
  if (c == '\n')
    {
      row++;
    }
  else if (c == '\r')
    {
      col = txinfo.winleft - 1;
    }
  else if (c == '\b')
  {
      if (col > txinfo.winleft - 1)
          col--;
      else if (row > txinfo.wintop -1)
      {
          /*
           * Turbo-C ignores this case; we are smarter.
           */
          row--;
          col = txinfo.winright-1;
      }
  }
  else if (c == 0x07)
    bell();
  else {
    /* short   val = c | (ScreenAttrib << 8); */
    /* puttext(col + 1, row + 1, col + 1, row + 1, &val); */
    ScreenPutChar(c, ScreenAttrib, col, row);
    col++;
  }

  /* now, readjust the window     */

  if (col >= txinfo.winright) {
    col = txinfo.winleft - 1;
    row++;
  }

  if (row >= txinfo.winbottom) {
    /* scrollwin(0, txinfo.winbottom - txinfo.wintop, 1); */
    if (_wscroll)
    {
      ScreenSetCursor(txinfo.wintop-1,0);
      delline();
    }
    row--;
  }

  ScreenSetCursor(row, col);
  txinfo.cury = row - txinfo.wintop + 2;
  txinfo.curx = col - txinfo.winleft + 2;
  return c;
}
コード例 #16
0
ファイル: gtab.c プロジェクト: duomaxwellr/hime
static void bell_err()
{
  if (test_mode)
    return;

  bell();
  set_gtab_input_error_color();
}
コード例 #17
0
ファイル: ui-birth.c プロジェクト: danaris/tgcangband
/**
 * ------------------------------------------------------------------------
 * The rolling bit of the roller.
 * ------------------------------------------------------------------------ */
static enum birth_stage roller_command(bool first_call)
{
	char prompt[80] = "";
	size_t promptlen = 0;

	struct keypress ch;

	enum birth_stage next = BIRTH_ROLLER;

	/* Used to keep track of whether we've rolled a character before or not. */
	static bool prev_roll = FALSE;

	/* Display the player - a bit cheaty, but never mind. */
	display_player(0);

	if (first_call)
		prev_roll = FALSE;

	/* Prepare a prompt (must squeeze everything in) */
	strnfcat(prompt, sizeof (prompt), &promptlen, "['r' to reroll");
	if (prev_roll) 
		strnfcat(prompt, sizeof(prompt), &promptlen, ", 'p' for previous roll");
	strnfcat(prompt, sizeof (prompt), &promptlen, " or 'Enter' to accept]");

	/* Prompt for it */
	prt(prompt, Term->hgt - 1, Term->wid / 2 - promptlen / 2);
	
	/* Prompt and get a command */
	ch = inkey();

	/* Analyse the command */
	if (ch.code == ESCAPE) {
		/* Back out */
		next = BIRTH_BACK;
	} else if (ch.code == KC_ENTER) {
		/* 'Enter' accepts the roll */
		next = BIRTH_NAME_CHOICE;
	} else if ((ch.code == ' ') || (ch.code == 'r')) {
		/* Reroll this character */
		cmdq_push(CMD_ROLL_STATS);
		prev_roll = TRUE;
	} else if (prev_roll && (ch.code == 'p')) {
		/* Previous character */
		cmdq_push(CMD_PREV_STATS);
	} else if (ch.code == KTRL('X')) {
		/* Quit */
		quit(NULL);
	} else if (ch.code == '?') {
		/* Help XXX */
		do_cmd_help();
	} else {
		/* Nothing handled directly here */
		bell("Illegal roller command!");
	}

	return next;
}
コード例 #18
0
ファイル: spells.c プロジェクト: ZetaZeta/poschengband
static int _choose_spell(spell_info* spells, int ct, cptr desc, int max_cost)
{
    int choice = -1;
    char prompt1[140];
    char prompt2[140];
    variant name;
    bool describe = FALSE;

    var_init(&name);

    for (;;)
    {
        char ch = '\0';

        strnfmt(prompt1, 78, "Use which %s? (Type '?' to Browse) ", desc);
        strnfmt(prompt2, 78, "Browse which %s? (Type '?' to Use)", desc);
        _list_spells(spells, ct, max_cost);

        /* Prompt User */
        choice = -1;

        if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break;

        if (ch == '?')
        {
            describe = !describe;
            if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break;
        }

        if (isupper(ch))
            choice = ch - 'A' + 26;
        else if (islower(ch))
            choice = ch - 'a';
        else if (ch >= '0' && ch <= '9')
            choice = ch - '0' + 52;

        /* Valid Choice? */
        if (choice < 0 || choice >= ct)
        {
            bell();
            continue;
        }

        if (describe)
        {
            _describe_spell(&spells[choice], _col_height(ct));
            continue;
        }

        /* Good to go! */
        break;
    }
    
    var_clear(&name);
    return choice;
}
コード例 #19
0
ファイル: ding.cpp プロジェクト: galoou/Ding
void Ding::play()
{
    elapsedTime = 0;
    emit elapsedTimeChanged(elapsedTime);

    timer->start(1000);
    emit onPlay(interval);

    bell();
}
コード例 #20
0
int main(int argc,char **argv){
    
    byte com=0;                             	// シリアルCOMポート番号
    byte dev_bell[8];                       	// XBee子機(ベル)デバイスのアドレス
    byte dev_sw[8];                         	// XBee子機(スイッチ)デバイスのアドレス
    byte trig=0;                                // 子機へデータ要求するタイミング調整用
    XBEE_RESULT xbee_result;                	// 受信データ(詳細)

    if(argc==2) com=(byte)atoi(argv[1]);    	// 引数があれば変数comに代入する
    xbee_init( com );                       	// XBee用COMポートの初期化
    printf("Waiting for XBee Bell\n");
    xbee_atnj(60);                          	// デバイスの参加受け入れ
    xbee_from( dev_bell );                  	// 見つけた子機のアドレスを変数devへ
    bell(dev_bell,3);							// ベルを3回鳴らす
    xbee_end_device(dev_bell, 1, 0, 0);      	// 起動間隔1秒,自動測定OFF,SLEEP端子無効
    printf("Waiting for XBee Switch\n");
    xbee_atnj(60);                          	// デバイスの参加受け入れ
    xbee_from( dev_sw );                    	// 見つけた子機のアドレスを変数devへ
    bell(dev_bell,3);							// ベルを3回鳴らす
    xbee_gpio_init( dev_sw );               	// 子機のDIOにIO設定を行う
    xbee_end_device(dev_sw, 3, 0, 1);     		// 起動間隔3秒,自動送信OFF,SLEEP端子有効
    printf("done\n");

    while(1){
        if( trig == 0){
            xbee_force( dev_sw );                  		// 子機へデータ要求を送信
            trig = FORCE_INTERVAL;
        }
        trig--;
        xbee_rx_call( &xbee_result );                   // データを受信
        switch( xbee_result.MODE ){                     // 受信したデータの内容に応じて
            case MODE_RESP:
            case MODE_GPIN:                             // 子機XBeeの自動送信の受信
                if(xbee_result.GPI.PORT.D1 == 0){
	                printf("D1=0 Ring\n");
	                bell(dev_bell,3);					// ベルを3回鳴らす
	            }else printf("D1=1\n");
                bell(dev_bell,0);						// ベル音を消す
                break;
        }
    }
}
コード例 #21
0
ファイル: ding.cpp プロジェクト: galoou/Ding
void Ding::incrementElapsedTime()
{
    elapsedTime++;
    emit elapsedTimeChanged(elapsedTime);

    if (elapsedTime < interval)
        return;

    bell();

    resetElapsedTime();
}
コード例 #22
0
ファイル: main.cpp プロジェクト: ltf1320/programdesign
int main(void)
{
    int n = 0;
    int T;
    scanf("%d",&T);
    while (T--)
    {
        scanf("%d",&n);
        int ans=bell(n);
        printf("%d\n",ans);
    }
}
コード例 #23
0
ファイル: hack.pager.c プロジェクト: juanfra684/DragonFlyBSD
int
dohelp(void)
{
	char c;

	pline("Long or short help? ");
	while (((c = readchar()) != 'l') && (c != 's') && !strchr(quitchars, c))
		bell();
	if (!strchr(quitchars, c))
		page_file((c == 'l') ? HELP : SHELP, FALSE);
	return (0);
}
コード例 #24
0
ファイル: five.c プロジェクト: madoldman/inankai_bbs
void quit(void)
{
    move(12,35);
    outs("©°¡ª¡ª¡ª¡ª¡ª¡ª¡ª©´");
    move(13,35);
    outs("©¦  ¶Ô·½Í˳öÁË  ©¦");
    move(14,35);
    outs("©¸¡ª¡ª¡ª¡ª¡ª¡ª¡ª©¼");
    refresh ();
    bell();
    press ();
}
コード例 #25
0
ファイル: chess.c プロジェクト: yrchen/Athena
static void mainloop(int s, board_t board) {
    int endgame;
    board_t tmpbrd;
    play_func_t play_func[2];

    play_func[chc_my] = myplay;
    play_func[chc_my ^ 1] = hisplay;
    for(chc_turn = 1, endgame = 0; !endgame; chc_turn ^= 1) {
        chc_firststep = 0;
        chc_drawline(board, TURN_ROW);
        if(chc_ischeck(board, chc_turn)) {
            strcpy(chc_warnmsg, "\033[1;31m將軍!\033[m");

            bell();
        } else
            chc_warnmsg[0] = 0;
        chc_drawline(board, WARN_ROW);
        endgame = play_func[chc_turn](s, board, tmpbrd);
    }

    if(endgame == 1) {
        strcpy(chc_warnmsg, "對方認輸了!");
        my.chc_win++;
        chc_hislose++;
    } else if(endgame == 2) {
        strcpy(chc_warnmsg, "你認輸了!");
        my.chc_lose++;
        chc_hiswin++;
    } else {
        strcpy(chc_warnmsg, "和棋");
        my.chc_tie++;
        chc_histie++;
    }

    chc_save(cuser.userid,1);
    chc_save(uin->userid,2);
    chc_drawline(board, WARN_ROW);
    bell();
    oflush();
}
コード例 #26
0
 pair<int, int> mcmf(int S, int T) {
     int d;
     int flow = 0, cost = 0;
     while ((d = bell(S, T))) {
         flow += d;
         for (int v = T; v != S; v = adj[st[v]->v][st[v]->b].v) {
             cost += st[v]->w * d;
             st[v]->c -= d;
             adj[st[v]->v][st[v]->b].c += d;
         }
     }
     return make_pair(flow, cost);
 }
コード例 #27
0
ファイル: h19.cpp プロジェクト: mgarlanger/VirtualH89
/// \brief Process transmit line 25
///
void
H19::transmitLine25()
{
    // if line 25 is not enabled, only send CR and ring bell.
    if (line25_m)
    {
        // Transmit line 25.
        transmitLines(rowsMain_c, rowsMain_c);
    }

    sendData(ascii::CR);
    bell();
}
コード例 #28
0
static int _choose_form_imp(int ct)
{
    int choice = -1;
    char prompt1[140];
    char prompt2[140];
    bool describe = FALSE;

    strnfmt(prompt1, 78, "Mimic which %s? (Type '?' to Browse) ", "Race");
    strnfmt(prompt2, 78, "Browse which %s? (Type '?' to Use)", "Race");
    _list_forms(ct);

    for (;;)
    {
        char ch = '\0';

        /* Prompt User */
        choice = -1;
        if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break;

        if (ch == '?')
        {
            describe = !describe;
            if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break;
        }

        if (isupper(ch))
            choice = ch - 'A' + 26;
        else if (islower(ch))
            choice = ch - 'a';
        else if (ch >= '0' && ch <= '9')
            choice = ch - '0' + 52;

        /* Valid Choice? */
        if (choice < 0 || choice >= ct)
        {
            bell();
            continue;
        }

        if (describe)
        {
            _describe_form(choice, _col_height(ct));
            continue;
        }

        /* Good to go! */
        break;
    }
    
    return choice;
}
コード例 #29
0
ファイル: mbbsd.c プロジェクト: yrchen/Athena
static void 
write_request()
{
	time_t		now;
	/* Half-hour remind  */
	if (*currmsg) {
		outmsg(currmsg);
		bell();
		*currmsg = 0;
		return;
	}
	time(&now);

#ifdef  LINUX
	signal(SIGUSR2, write_request);
#endif

	update_data();
	++cuser.receivemsg;
	substitute_record(fn_passwd, &cuser, sizeof(userec), usernum);
	bell();
	show_last_call_in();
	/* wildcat patch : 看不到水球??!! */
	currutmp->msgcount--;
	memcpy(&oldmsg[no_oldmsg], &currutmp->msgs[0], sizeof(msgque));
	no_oldmsg++;
	no_oldmsg %= MAX_REVIEW;
	if (oldmsg_count < MAX_REVIEW)
		oldmsg_count++;
	if (watermode) {
		if (watermode < oldmsg_count)
			watermode++;
		t_display_new(0);
	}
	refresh();
	currutmp->msgcount = 0;
}
コード例 #30
0
ファイル: chc_play.c プロジェクト: YanlongLai/Program
static void mainloop(int s, board_t board) {
    int endgame;
    board_t tmpbrd;
    play_func_t play_func[2];
    
    play_func[chc_my] = myplay;
    play_func[chc_my ^ 1] = hisplay;
    for(chc_turn = 1, endgame = 0; !endgame; chc_turn ^= 1) {
	chc_firststep = 0;
	chc_drawline(board, TURN_ROW);
	if(chc_ischeck(board, chc_turn)) {
	    strcpy(chc_warnmsg, "\033[1;31m將軍!\033[m");
	    bell();
	} else
	    chc_warnmsg[0] = 0;
	chc_drawline(board, WARN_ROW);
	endgame = play_func[chc_turn](s, board, tmpbrd);
    }
    
    if(endgame == 1) {
	strcpy(chc_warnmsg, "對方認輸了!");
	cuser.chc_win++;
    } else if(endgame == 2) {
	strcpy(chc_warnmsg, "你認輸了!");
	cuser.chc_lose++;
    } else {
	strcpy(chc_warnmsg, "和棋");
	cuser.chc_tie++;
    }
    cuser.chc_lose--;
    reload_money();
    passwd_update(usernum, &cuser);
    chc_drawline(board, WARN_ROW);
    bell();
    oflush();
}