Fix GUI2 multiplayer tests getting stuck

This commit is contained in:
Jyrki Vesterinen 2016-09-13 21:22:23 +03:00
parent c4992dcd38
commit 5e930ea5fb
5 changed files with 22 additions and 2 deletions

View file

@ -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;
}

View file

@ -136,6 +136,7 @@ public:
, focus_()
, restore_(false)
, allow_plugin_skip_(true)
, show_even_without_video_(false)
{
}
@ -179,6 +180,11 @@ public:
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.
@ -345,6 +351,13 @@ private:
*/
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;

View file

@ -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

View file

@ -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();

View file

@ -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));