Ejemplo n.º 1
0
void mp_staging::on_team_select(window& window, ng::side_engine_ptr side, menu_button& team_menu, bool& handled, bool& halt)
{
	side->set_team(team_menu.get_value());

	// First, remove the node from the tree
	find_widget<tree_view>(&window, "side_list", false).remove_node(side_tree_map_[side]);

	// Then add a new node as a child to the appropriate team's node
	add_side_node(window, side);

	set_state_changed();

	handled = true;
	halt = true;
}
Ejemplo n.º 2
0
void mp_staging::on_team_select(window& window, ng::side_engine_ptr side, menu_button& team_menu)
{
	// Since we're not necessarily displaying every every team in the menu, we can't just
	// use the selected index to set a side's team. Instead, we grab the index we stored
	// in add_side_node from the selected config, which should correspond to the
	// appropriate entry in the connect_engine's team name vector.
	const unsigned team_index = team_menu.get_value_config()["team_index"].to_unsigned();

	if(team_index == side->team()) {
		return;
	}

	side->set_team(team_index);

	// First, remove the node from the tree
	auto node = find_widget<tree_view>(&window, "side_list", false).remove_node(side_tree_map_[side]);

	// Then add a new node as a child to the appropriate team's node
	team_tree_map_[side->team_name()]->add_child(std::move(node.first), get_side_node_position(side));

	set_state_changed();
}