예제 #1
0
void team::change_controller_by_wml(const std::string& new_controller_string)
{
	CONTROLLER new_controller;
	if(!new_controller.parse(new_controller_string)) {
		WRN_NG << "ignored attempt to change controller to " << new_controller_string << std::endl;
		return;
	}

	if(new_controller == CONTROLLER::EMPTY && resources::controller->current_side() == this->side()) {
		WRN_NG << "ignored attempt to change the currently playing side's controller to 'null'" << std::endl;
		return;
	}

	config choice = synced_context::ask_server_choice(controller_server_choice(new_controller, *this));
	if(!new_controller.parse(choice["controller"])) {
		// TODO: this should be more than a ERR_NG message.
		// GL-2016SEP02 Oh? So why was ERR_NG defined as warning level? Making the call fit the definition.
		WRN_NG << "Received an invalid controller string from the server" << choice["controller"] << std::endl;
	}

	if(!resources::controller->is_replay()) {
		set_local(choice["is_local"].to_bool());
	}

	change_controller(new_controller);
}
예제 #2
0
UINT MIDIFile::change_controller_selected(UINT type,int value, bool percent)
{
	//	percent = HP_PERCENT:		change old value with percent-value, 150: +50%, 60: 60%
	//	percent = HP_NO_PERCENT:	new value gets value

	MIDIEvent *mev;
	int id;
	for (id = 0; id < eventlist->get_length(); id++)	
	{
		mev = eventlist->get(id);
		if ((mev->type != type) || (mev->selected == 0)) continue;
		change_controller(id,type,value,percent);
	}
	return HP_ERR_NONE;
}