]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/drain.cpp
-Se conectan como trompada!!!!!
[z.facultad/75.42/plaqui.git] / Constructor / drain.cpp
index cd4ee57d73f591ea306a297c669b541514969a44..3625677a1638db537e082d23fce42d4e6f703366 100644 (file)
@@ -83,6 +83,8 @@ void Drain::on_menu_popup_propiedades()
 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);
@@ -91,6 +93,7 @@ void Drain::save(FILE *archivo)
        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;
@@ -100,21 +103,27 @@ void Drain::save(FILE *archivo)
 
 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)