News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

[DONE] Choose tabs when using "open_info_win"

Started by Yona-TYT, April 19, 2017, 01:56:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

I have modified the following:

/gui/scenario_info.h (line 61)

    void open_info_tab();

    void open_goal_tab();

    void open_rules_tab();

    void open_result_tab();

    void open_about_tab();


/gui/scenario_info.cc (line 165)
void scenario_info_t::open_info_tab()
{
    tabs.set_active_tab_index(0);
    resize(scr_coord(0,0));
    set_dirty();
}

void scenario_info_t::open_goal_tab()
{
    tabs.set_active_tab_index(1);
    resize(scr_coord(0,0));
    set_dirty();
}

void scenario_info_t::open_rules_tab()
{
    tabs.set_active_tab_index(2);
    resize(scr_coord(0,0));
    set_dirty();
}

void scenario_info_t::open_result_tab()
{
    tabs.set_active_tab_index(3);
    resize(scr_coord(0,0));
    set_dirty();
}

void scenario_info_t::open_about_tab()
{
    tabs.set_active_tab_index(4);
    resize(scr_coord(0,0));
    set_dirty();
}


/dataobj/scenario.h (line 282)
    bool open_info_win(int opt) const;


/dataobj/scenario.cc (line 780)
bool scenario_t::open_info_win(int opt) const
{
    // pop up for the win
    scenario_info_t *si = (scenario_info_t*)win_get_magic(magic_scenario_info);
    if (si == NULL) {
        si = new scenario_info_t();
        create_win(si, w_info, magic_scenario_info);
    }
    if (opt==0)
        si->open_info_tab();
    else if (opt==1)
        si->open_goal_tab();
    else if (opt==2)
        si->open_rules_tab();
    else if (opt==3)
        si->open_result_tab();
    else
        si->open_about_tab();
    return true; // dummy return value
}


/script/api/api_gui.cc (line 45)

        /**
        * Opens scenario info window.
         * @param no.0 open Information windows
         * @param no.1 open Goal windows
         * @param no.2 open Rules windows
         * @param no.3 open Result windows
         * @param no.4 open About windows
        * @note Only available in scenario mode.
        */
        STATIC register_method(vm, &scenario_t::open_info_win, "open_info_win");


Dwachs

Parsley, sage, rosemary, and maggikraut.