void playmp_controller::wait_for_upload()
{
	// If the host is here we'll never leave since we wait for the host to
	// upload the next scenario.
	assert(!is_host());

	config cfg;
	network_reader_.set_source(playturn_network_adapter::get_source_from_config(cfg));
	while(true) {
		try {
			const bool  res = dialogs::network_receive_dialog(
				gui_->video(), _("Waiting for next scenario..."), cfg, mp_info_->wesnothd_connection);

			if(res) {
				if (turn_data_.process_network_data_from_reader() == turn_info::PROCESS_END_LINGER) {
					break;
				}
			}
			else
			{
				throw_quit_game_exception();
			}

		} catch(const quit_game_exception&) {
			network_reader_.set_source([this](config& cfg) { return recieve_from_wesnothd(cfg);});
			turn_data_.send_data();
			throw;
		}
	}
	network_reader_.set_source([this](config& cfg) { return recieve_from_wesnothd(cfg);});
}
playsingle_controller::playsingle_controller(const config& level,
	saved_game& state_of_game,
	const config& game_config, const ter_data_cache & tdata,
	CVideo& video, bool skip_replay)
	: play_controller(level, state_of_game, game_config, tdata, video, skip_replay)
	, cursor_setter_(cursor::NORMAL)
	, textbox_info_()
	, replay_sender_(*resources::recorder)
	, network_reader_([this](config& cfg) {return recieve_from_wesnothd(cfg);})
	, turn_data_(replay_sender_, network_reader_)
	, end_turn_(END_TURN_NONE)
	, skip_next_turn_(false)
	, replay_()
{
	hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the sp (whiteboard enabled) version


	// game may need to start in linger mode
	linger_ = this->is_regular_game_end();

	ai::game_info ai_info;
	ai::manager::set_ai_info(ai_info);
	ai::manager::add_observer(this) ;

	plugins_context_->set_accessor_string("level_result", std::bind(&playsingle_controller::describe_result, this));
	plugins_context_->set_accessor_int("turn", std::bind(&play_controller::turn, this));
}