void Drain::save(FILE *archivo)
{
char c_id[50], c_x[50], c_y[50], c_img[50];
+ Glib::ustring con0;
+ con0 = "\t\t\t<entrada>"+get_other_name(connect_vec[0].id_dest)+"</entrada>\n";
sprintf(c_x,"\t\t<x>%d</x>\n",x);
sprintf(c_y,"\t\t<y>%d</y>\n",y);
sprintf(c_id,"%d",ID);
dato = "\t<drenaje nombre=\""+name+"\" id=\"";
dato += c_id;
dato += "\">\n";
+ dato += "\t\t<conector>\n"+con0+"\t\t</conector>\n";
dato += c_img;
dato += c_x;
dato += c_y;
bool Drain::check_connection()
{
+ CItem *_item0;
ConnectorType temp;
switch (get_img_actual()) {
case 0:
- temp = is_other_connection_area( get_position_x()+16 , get_position_y() -5);
+ temp = is_other_connection_area( get_position_x()+16 , get_position_y() -5,& _item0);
break;
case 1:
- temp = is_other_connection_area( get_position_x()+image->get_width() + 5, get_position_y()+16);
+ temp = is_other_connection_area( get_position_x()+image->get_width() + 5, get_position_y()+16,& _item0);
break;
case 2:
- temp = is_other_connection_area( get_position_x()+16, get_position_y()+image->get_height()+5);
+ temp = is_other_connection_area( get_position_x()+16, get_position_y()+image->get_height()+5, &_item0);
break;
case 3:
- temp = is_other_connection_area( get_position_x()-5, get_position_y()+16);
+ temp = is_other_connection_area( get_position_x()-5, get_position_y()+16,& _item0);
}
- return ( is_connected = (temp == OUT) );
+ if ( is_connected = (temp == OUT) ) {
+ connect_vec[0].id_dest = _item0->get_id();
+ return is_connected;
+ }
+ std::cout<<"conector dest ="<<temp<<std::endl;
+ return is_connected;
}
ConnectorType Drain::get_connector_type(int _a, int _b)
}
return UNDEF;
}
+
+void Drain::set_default_connector()
+{
+ connect_vec[0].type = IN;
+}