static void enter_create_mode(game_display& disp, const config& game_config, mp::chat& chat, config& gamelist, mp::controller default_controller, bool local_players_only)
{
	if (0 && gui2::new_widgets) {

		gui2::tmp_create_game dlg(game_config);

		dlg.show(disp.video());

		network::send_data(config("refresh_lobby"), 0, true);
	} else {

		mp::ui::result res;
		mp_game_settings params;
		int num_turns;

		{
			mp::create ui(disp, game_config, chat, gamelist);
			run_lobby_loop(disp, ui);
			res = ui.get_result();
			params = ui.get_parameters();
			num_turns = ui.num_turns();
		}

		switch (res) {
		case mp::ui::CREATE:
			enter_connect_mode(disp, game_config, chat, gamelist, params, num_turns, default_controller, local_players_only);
			break;
		case mp::ui::QUIT:
		default:
			//update lobby content
			network::send_data(config("refresh_lobby"), 0, true);
			break;
		}
	}
}
Example #2
0
bool enter_configure_mode(game_display& disp, const config& game_config, saved_game& state, bool local_players_only) {
	bool connect_canceled;
	do {
		connect_canceled = false;

		mp::ui::result res;

		{
			mp::configure ui(disp, game_config, gamechat, gamelist, state, local_players_only);
			mp::run_lobby_loop(disp, ui);
			res = ui.get_result();
			ui.get_parameters();
		}

		switch (res) {
		case mp::ui::CREATE:
			connect_canceled = !enter_connect_mode(disp, game_config, state, local_players_only);
			break;
		case mp::ui::QUIT:
		default:
			return false;
		}
	} while (connect_canceled);
	return true;
}
Example #3
0
static void enter_create_mode(game_display& disp, const config& game_config, hero_map& heros, hero_map& heros_start, 
		card_map& cards, config& gamelist, mp::controller default_controller, bool local_players_only)
{
	mp::ui::result res;
	mp_game_settings params;
	int num_turns;

	// if (gui2::new_widgets) {
		gui2::tmp_create_game dlg(disp, game_config);
		dlg.show(disp.video());
		int retval = dlg.get_retval();
		if (retval == gui2::twindow::OK) {
			res = mp::ui::CREATE;
		} else {
			res = mp::ui::QUIT;
		}
		params = dlg.get_parameters();
		num_turns = dlg.num_turns();

		// network::send_data(config("refresh_lobby"), 0);

	switch (res) {
	case mp::ui::CREATE:
		enter_connect_mode(disp, game_config, heros, heros_start, cards, gamelist, params, num_turns, default_controller, local_players_only);
		break;
	case mp::ui::QUIT:
	default:
		//update lobby content
		network::send_data(config("refresh_lobby"), 0);
		break;
	}
}
static bool enter_configure_mode(game_display& disp, const config& game_config,
	saved_game& state, bool local_players_only)
{
	DBG_MP << "entering configure mode" << std::endl;

	bool connect_canceled;

	do {
		connect_canceled = false;

		mp::ui::result res;

		{
			mp::configure ui(disp, game_config, gamechat, gamelist, state,
				local_players_only);
			run_lobby_loop(disp, ui);
			res = ui.get_result();
			ui.get_parameters();
		}

		switch (res) {
		case mp::ui::CREATE:
			connect_canceled = !enter_connect_mode(disp, game_config,
				state, local_players_only);
			break;
		case mp::ui::QUIT:
		default:
			//update lobby content
			network::send_data(config("refresh_lobby"), 0);
			return false;
		}
	} while(connect_canceled);

	return true;
}
Example #5
0
bool enter_configure_mode(CVideo& video, const config& game_config, saved_game& state, ng::create_engine& create_eng, bool local_players_only)
{
	if(!gui2::tsp_options_configure::execute(create_eng, video)) {
		return false;
	}

	create_eng.get_parameters();
	create_eng.prepare_for_new_level();

	enter_connect_mode(video, game_config, state, local_players_only);

	return true;
}
Example #6
0
static void enter_create_mode(game_display& disp, const config& game_config,
	game_state& state, bool local_players_only)
{
	DBG_MP << "entering create mode" << std::endl;

	bool configure_canceled;
	bool connect_canceled;

	do {
		configure_canceled = false;
		connect_canceled = false;

		if (gui2::new_widgets) {

			gui2::tmp_create_game dlg(game_config);

			dlg.show(disp.video());

			network::send_data(config("refresh_lobby"), 0);
		} else {

			mp::ui::result res;
			mp_game_settings new_params;

			{
				mp::create ui(disp, game_config, state, gamechat, gamelist);
				run_lobby_loop(disp, ui);
				res = ui.get_result();
				new_params = ui.get_parameters();
			}

			switch (res) {
			case mp::ui::CREATE:
				configure_canceled = !enter_configure_mode(disp, game_config,
					state, new_params, local_players_only);
				break;
			case mp::ui::LOAD_GAME:
				connect_canceled = !enter_connect_mode(disp, game_config,
					state, new_params, local_players_only);
				break;
			case mp::ui::QUIT:
			default:
				//update lobby content
				network::send_data(config("refresh_lobby"), 0);
				break;
			}
		}
	} while(configure_canceled || connect_canceled);
}