Exemple #1
0
/* display the option dialog */
void display_options(nh_bool change_birth_opt)
{
    struct nh_menuitem *items;
    int icount, size;
    struct nh_option_desc *nhoptions = nh_get_options(GAME_OPTIONS);
    struct nh_option_desc *birthoptions = NULL;
    int n;
    
    size = 10;
    items = malloc(sizeof(struct nh_menuitem) * size);
    
    do {
	icount = 0;
	if (!change_birth_opt) {
	    birthoptions = nh_get_options(ACTIVE_BIRTH_OPTIONS);
	    /* add general game options */
	    add_menu_txt(items, size, icount, "游戏设置:", MI_HEADING);
	    menu_add_options(&items, &size, &icount, GAME_OPTS, nhoptions,
				FALSE);
	    
	    /* add or display birth options */
	    add_menu_txt(items, size, icount, "本次游戏人物设置:",
			    MI_HEADING);
	    menu_add_options(&items, &size, &icount, ACT_BIRTH_OPTS,
				birthoptions, TRUE);
	} else {
	    birthoptions = nh_get_options(CURRENT_BIRTH_OPTIONS);
	    /* add or display birth options */
	    add_menu_txt(items, size, icount, "创建人物设置:", MI_HEADING);
	    menu_add_options(&items, &size, &icount, CUR_BIRTH_OPTS,
				birthoptions, FALSE);
	    
	    add_menu_txt(items, size, icount, "游戏设置:", MI_HEADING);
	    menu_add_options(&items, &size, &icount, GAME_OPTS, nhoptions, FALSE);
	}
	
	/* add UI specific options */
	add_menu_txt(items, size, icount, "界面设置:", MI_HEADING);
	menu_add_options(&items, &size, &icount, UI_OPTS, curses_options, FALSE);
	
	n = curses_display_menu_core(items, icount, "选择哪个设置?", PICK_ONE,
				     NULL, 0, 0, -1, -1, get_option_value, FALSE);
    } while (n > 0);
    free(items);
    
    write_config();
}
Exemple #2
0
/* display the option dialog */
void
display_options(nh_bool change_birth_opt)
{
    struct nh_menulist menu;
    struct nh_option_desc *options;
    int selected[1];

    do {
        init_menulist(&menu);
        options = curses_get_nh_opts();

        if (!change_birth_opt) {
            /* add general game options */
            add_menu_txt(&menu, "Game options:", MI_HEADING);
            menu_add_options(&menu, GAME_OPTS, options, nh_birth_ingame, FALSE);

            /* add or display birth options */
            add_menu_txt(&menu, "Birth options for this game:", MI_HEADING);
            menu_add_options(&menu, BIRTH_OPTS, options,
                             nh_birth_lasting, TRUE);
        } else {
            /* add or display birth options */
            add_menu_txt(&menu, "Birth options:", MI_HEADING);
            menu_add_options(&menu, BIRTH_OPTS, options,
                             nh_birth_lasting, FALSE);

            add_menu_txt(&menu, "Game creation options:", MI_HEADING);
            menu_add_options(&menu, CREATION_OPTS, options,
                             nh_birth_creation, FALSE);

            add_menu_txt(&menu, "Game options:", MI_HEADING);
            menu_add_options(&menu, GAME_OPTS, options, nh_birth_ingame, FALSE);
        }

        /* add UI specific options */
        add_menu_txt(&menu, "Interface options:", MI_HEADING);
        menu_add_options(&menu, UI_OPTS, curses_options, FALSE, FALSE);

        curses_display_menu_core(
            &menu, "Set what options?", PICK_ONE, selected,
            curses_menu_callback, 0, 0, -1, -1, FALSE, query_new_value, TRUE);

        curses_free_nh_opts(options);
    } while (*selected != CURSES_MENU_CANCELLED);

    write_ui_config();
    if (!game_is_running)
        write_nh_config();
}