Example #1
0
bool enter_connect_mode(game_display& disp, const config& game_config,
	saved_game& state, bool local_players_only) {

	ng::connect_engine connect_eng(state, true, NULL);

	if (state.mp_settings().show_connect) {
		mp::ui::result res;
		gamelist.clear();
		{
			mp::connect ui(disp, state.mp_settings().name, game_config, gamechat, gamelist, connect_eng);
			mp::run_lobby_loop(disp, ui);
			res = ui.get_result();

			if (res == mp::ui::PLAY) {
				ui.start_game();
			}
		}
		switch (res) {
		case mp::ui::PLAY:
			return true;
		case mp::ui::CREATE:
			enter_create_mode(disp, game_config, state, jump_to_campaign_info(false, -1, "", ""), local_players_only);
			break;
		case mp::ui::QUIT:
		default:
			return false;
		}
		return true;
	} else {
		connect_eng.start_game();
		return true;
	}
}
Example #2
0
bool enter_connect_mode(CVideo& /*video*/, const config& /*game_config*/, saved_game& state, bool /*local_players_only*/)
{
	ng::connect_engine connect_eng(state, true, nullptr);

	// TODO: fix. Dialog starts game regardless of selection
#if 0
	if(state.mp_settings().show_connect) {
		lobby_info li(game_config, std::vector<std::string>());

		gui2::dialogs::mp_staging dlg(connect_eng, li);
		dlg.show(video);

		if(dlg.get_retval() != gui2::window::OK) {
			// TODO: enable the workflow loops from GUI1
			//return enter_create_mode(video, game_config, state, jump_to_campaign_info(false, -1, "", ""), local_players_only);

			return false;
		}
	}
#endif

	connect_eng.start_game();

	return true;
}