예제 #1
0
파일: police.c 프로젝트: startmenu/ythtbbs
int
money_cop()
{
    int ch, quit = 0;
    char uident[IDLEN + 1], buf[256];

    if (!(myInfo->GetLetter == 1)) {
        clear();
        showAt(5, 4, "你已经关闭了金融中心游戏功能,请开启后再来。",
               YEA);
        return 0;
    }

    while (!quit) {
        sprintf(buf, "%s警署", CENTER_NAME);
        nomoney_show_stat(buf);
        move(8, 16);
        prints("打击犯罪,维持治安!");
        move(10, 4);
        prints("近期犯罪活动大大增加,刑警们也开始日以继夜的加班。");
        move(t_lines - 1, 0);
        prints("\033[1;44m 选单 \033[1;46m [1]报案 [2]通缉榜"
               " [3]刑警队 [4]署长办公室 [Q]离开\033[m");
        ch = igetkey();
        switch (ch) {
        case '1':
            nomoney_show_stat("警署接待厅");
            cop_accuse();
            break;
        case '2':
            clear();
            move(1, 0);
            prints("%s警署当前通缉的犯罪嫌疑人:", CENTER_NAME);
            listfilecontent(DIR_MC "criminals_list");
            FreeNameList();
            pressanykey();
            break;
        case '3':
            cop_police();
            break;
        case '4':
            nomoney_show_stat("署长办公室");
            whoTakeCharge(8, uident);
            if (strcmp(currentuser->userid, uident))
                break;
            showAt(6, 0, "    请选择操作代号:\n"
                   "        1. 任命警员         2. 解职警员\n"
                   "        3. 警员名单         4. 保释罪犯\n"
                   "        5. 查询             Q. 退出", NA);
            ch = igetkey();
            switch (ch) {
            case '1':
            case '2':
                cop_arrange(ch - '0');
                break;
            case '3':
                clear();
                move(1, 0);
                prints("目前%s警署警员名单:", CENTER_NAME);
                listfilecontent(DIR_MC "policemen");
                FreeNameList();
                pressanykey();
                break;
            case '4':
                break;
            case '5':
                SearchCrime();
            }
            break;
        case 'q':
        case 'Q':
            quit = 1;
            break;
        }
        limit_cpu();
    }
    return 0;
}
예제 #2
0
파일: map.c 프로젝트: long5313828/ythtbbs
int
walk_map(McMap * mcMap)
{
	int i, j, ch, r, walk;
	unsigned short exits;

	i = mcMap->prev_x;
	j = mcMap->prev_y;

	for (walk = 0; map_valid(mcMap);) {
		r = 4;
		myInfo->pos_x = i;
		myInfo->pos_y = j;
		money_show_stat("邪恶荒原");
		move(r++, 0);
		prints
		    ("这里是大富翁城外不远的邪恶荒原, 周围荒草凄凄, 静寂得令人毛骨悚然.");
		if (myInfo->health < 1) {
			showAt(++r, 0, "你没有足够的体力行走了...", YEA);
			continue;
		}
		move(t_lines - 2, 0);
		prints("[h 帮助]这里明显的出口是:");
		exits = mcMap->map[i][j].exit;
		if (exits & NODE_LEFT)
			prints("%s、", "←");
		if (exits & NODE_RIGHT)
			prints("%s、", "→");
		if (exits & NODE_UP)
			prints("%s、", "↑");
		if (exits & NODE_DOWN)
			prints("%s。", "↓");

		print_item(&mcMap->map[i][j], &r);

		ch = igetkey();
		if (ch == KEY_LEFT && (exits & NODE_LEFT)) {
			walk++;
			j--;
		} else if (ch == KEY_RIGHT && (exits & NODE_RIGHT)) {
			walk++;
			j++;
		} else if (ch == KEY_UP && (exits & NODE_UP)) {
			walk++;
			i--;
		} else if (ch == KEY_DOWN && (exits & NODE_DOWN)) {
			walk++;
			i++;
		} else if (ch == 'q' || ch == 'Q') {
			return 0;
		} else if (ch == 'h' || ch == 'H') {
			print_map_help();
		} else if (ch == KEY_TAB) {
			nomoney_show_stat("邪恶荒原");
			move(4, 0);
			print_map(mcMap, 1);
			pressanykey();
		} else if (ch == 'k' || ch == 'K') {
			kill_npc();
		} else if (ch == 'o') {
			open_box();
		} else {
			showAt(t_lines - 1, 0, ">你要做什么?", YEA);
		}
		//更新身体状态
		update_health();
		if (walk % 4 == 1) {
			walk++;
			myInfo->health--;
			limit_cpu();
		}
	}
	return 0;
}