Skip to content

Commit

Permalink
tunit_create: refactored out display argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Feb 25, 2016
1 parent a0909a9 commit ec88475
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/gui/dialogs/unit_create.cpp
Expand Up @@ -82,11 +82,10 @@ namespace gui2

REGISTER_DIALOG(unit_create)

tunit_create::tunit_create(display* disp)
tunit_create::tunit_create()
: gender_(last_gender)
, choice_(last_chosen_type_id)
, last_words_()
, disp_(disp)
{
}

Expand Down Expand Up @@ -412,14 +411,10 @@ bool tunit_create::filter_text_changed(ttext_* textbox, const std::string& text)

void tunit_create::profile_button_callback(twindow& window)
{
if(!disp_) {
return;
}

const int selected_row
= find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row();

help::show_unit_help(disp_->video(),
help::show_unit_help(window.video(),
units_[selected_row]->id(),
units_[selected_row]->show_variations_in_help(), false);
}
Expand Down
4 changes: 1 addition & 3 deletions src/gui/dialogs/unit_create.hpp
Expand Up @@ -32,7 +32,7 @@ namespace gui2
class tunit_create : public tdialog
{
public:
tunit_create(display* disp = NULL);
tunit_create();

/** Unit type choice from the user. */
const std::string& choice() const
Expand Down Expand Up @@ -61,8 +61,6 @@ class tunit_create : public tdialog

std::vector<std::string> last_words_;

display* disp_;

/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const;

Expand Down
2 changes: 1 addition & 1 deletion src/menu_events.cpp
Expand Up @@ -927,7 +927,7 @@ namespace { // Helpers for create_unit()
// The unit creation dialog makes sure unit types
// are properly cached.
//
gui2::tunit_create create_dlg(&gui);
gui2::tunit_create create_dlg;
create_dlg.show(gui.video());

if(create_dlg.no_choice()) {
Expand Down

0 comments on commit ec88475

Please sign in to comment.