Skip to content

Commit

Permalink
Fix for GNA584
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Apr 13, 2017
1 parent a836198 commit f3a574d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
7 changes: 1 addition & 6 deletions src/gui/dialogs/title_screen.cpp
Expand Up @@ -136,7 +136,6 @@ bool show_debug_clock_button = false;

title_screen::title_screen(game_launcher& game)
: game_(game)
, redraw_background_(true)
, debug_clock_(nullptr)
{
set_restore(false);
Expand Down Expand Up @@ -211,9 +210,6 @@ void title_screen::pre_show(window& win)
win.set_enter_disabled(true);
win.set_escape_disabled(true);

// Each time the dialog shows, we set this to false
redraw_background_ = false;

#ifdef DEBUG_TOOLTIP
win.connect_signal<event::SDL_MOUSE_MOTION>(
std::bind(debug_tooltip, std::ref(win), _3, _5),
Expand Down Expand Up @@ -472,8 +468,7 @@ void title_screen::pre_show(window& win)

void title_screen::on_resize(window& win)
{
redraw_background_ = true;
win.close();
win.set_retval(REDRAW_BACKGROUND);
}

void title_screen::update_tip(window& win, const bool previous)
Expand Down
9 changes: 2 additions & 7 deletions src/gui/dialogs/title_screen.hpp
Expand Up @@ -47,6 +47,8 @@ class title_screen : public modal_dialog
* Actions that merely show a dialog are not included here.
*/
enum result {
// Window was resized, so needs redrawing
REDRAW_BACKGROUND = 0, // Needs to be 0, the value of gui2::window::NONE
// Start playing a single-player game, such as the tutorial or a campaign
LAUNCH_GAME,
// Connect to an MP server
Expand All @@ -65,16 +67,9 @@ class title_screen : public modal_dialog
RELOAD_GAME_DATA,
};

bool redraw_background() const
{
return redraw_background_;
}

private:
game_launcher& game_;

bool redraw_background_;

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

Expand Down
4 changes: 3 additions & 1 deletion src/wesnoth.cpp
Expand Up @@ -785,7 +785,7 @@ static int do_gameloop(const std::vector<std::string>& args)
* Certain actions (such as window resizing) set the flag to true, which allows the dialog to reopen with any layout
* changes such as those dictated by window resolution.
*/
while(dlg.redraw_background()) {
while(dlg.get_retval() == gui2::dialogs::title_screen::REDRAW_BACKGROUND) {
dlg.show(game->video());
}

Expand Down Expand Up @@ -826,6 +826,8 @@ static int do_gameloop(const std::vector<std::string>& args)
case gui2::dialogs::title_screen::LAUNCH_GAME:
game->launch_game(should_reload);
break;
case gui2::dialogs::title_screen::REDRAW_BACKGROUND:
break;
}
}
}
Expand Down

1 comment on commit f3a574d

@CelticMinstrel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have the wrong issue number attached, anyone remember the correct one?

Please sign in to comment.