From ec88475d2309e4b89436ef255c6a82b975457da4 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Fri, 26 Feb 2016 07:03:52 +1100 Subject: [PATCH] tunit_create: refactored out display argument --- src/gui/dialogs/unit_create.cpp | 9 ++------- src/gui/dialogs/unit_create.hpp | 4 +--- src/menu_events.cpp | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gui/dialogs/unit_create.cpp b/src/gui/dialogs/unit_create.cpp index d5ccb9dc61ca..70e616c67359 100644 --- a/src/gui/dialogs/unit_create.cpp +++ b/src/gui/dialogs/unit_create.cpp @@ -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) { } @@ -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(&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); } diff --git a/src/gui/dialogs/unit_create.hpp b/src/gui/dialogs/unit_create.hpp index 7c1c4ee13383..fbd6be96d68a 100644 --- a/src/gui/dialogs/unit_create.hpp +++ b/src/gui/dialogs/unit_create.hpp @@ -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 @@ -61,8 +61,6 @@ class tunit_create : public tdialog std::vector last_words_; - display* disp_; - /** Inherited from tdialog, implemented by REGISTER_DIALOG. */ virtual const std::string& window_id() const; diff --git a/src/menu_events.cpp b/src/menu_events.cpp index b44fdd96f4fd..3987642d4a7f 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -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()) {