Skip to content

Commit

Permalink
Fix GUI2 multiplayer tests getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkive committed Sep 13, 2016
1 parent c4992dc commit 5e930ea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/dialogs/dialog.cpp
Expand Up @@ -35,7 +35,7 @@ tdialog::~tdialog()

bool tdialog::show(CVideo& video, const unsigned auto_close_time)
{
if(video.faked()) {
if(video.faked() && !show_even_without_video_) {
if(!allow_plugin_skip_) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions src/gui/dialogs/dialog.hpp
Expand Up @@ -136,6 +136,7 @@ class tdialog
, focus_()
, restore_(false)
, allow_plugin_skip_(true)
, show_even_without_video_(false)
{
}

Expand Down Expand Up @@ -179,6 +180,11 @@ class tdialog
allow_plugin_skip_ = allow_plugin_skip;
}

void set_show_even_without_video(const bool show_even_without_video)
{
show_even_without_video_ = show_even_without_video;
}

protected:
/**
* Creates a new boolean field.
Expand Down Expand Up @@ -345,6 +351,13 @@ class tdialog
*/
bool allow_plugin_skip_;

/**
* Show the dialog even with --nogui?
* Some dialogs need to be shown even when --nogui is specified if the game is being driven by a plugin.
* Those dialogs allow the plugin to control them by creating a plugin context in pre_show().
*/
bool show_even_without_video_;

/** The id of the window to build. */
virtual const std::string& window_id() const = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/gui/dialogs/lobby/lobby.cpp
Expand Up @@ -165,6 +165,8 @@ tlobby_main::tlobby_main(const config& game_config,
, delay_playerlist_update_(false)
, delay_gamelist_update_(false)
{
// Need to set this in the constructor, pre_show() is too late
set_show_even_without_video(true);
}

struct lobby_delay_gamelist_update_guard
Expand Down
2 changes: 2 additions & 0 deletions src/gui/dialogs/multiplayer/mp_create_game.cpp
Expand Up @@ -109,6 +109,8 @@ tmp_create_game::tmp_create_game(const config& cfg, ng::create_engine& create_en
mp_game_settings::RANDOM_FACTION_MODE::NO_ALLY_MIRROR,
};

set_show_even_without_video(true);

create_engine_.init_active_mods();

create_engine_.get_state() = saved_game();
Expand Down
5 changes: 4 additions & 1 deletion src/gui/widgets/window.cpp
Expand Up @@ -352,7 +352,10 @@ twindow::twindow(CVideo& video,

connect();

connect_signal<event::DRAW>(std::bind(&twindow::draw, this));
if (!video.faked())
{
connect_signal<event::DRAW>(std::bind(&twindow::draw, this));
}

connect_signal<event::SDL_VIDEO_RESIZE>(std::bind(
&twindow::signal_handler_sdl_video_resize, this, _2, _3, _5));
Expand Down

0 comments on commit 5e930ea

Please sign in to comment.