X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/fc545e363e5352e2a672b0fa6a39facf6dc7d36b..4addf1434015a4a1212c7949c1a44dba977c0a39:/Constructor/src/constructor.cpp diff --git a/Constructor/src/constructor.cpp b/Constructor/src/constructor.cpp index e352f4a..acf5bc1 100644 --- a/Constructor/src/constructor.cpp +++ b/Constructor/src/constructor.cpp @@ -1055,16 +1055,36 @@ void Constructor::create_line(xmlNodePtr nodo, int logic_id) t_line tmp_line; tmp_line.logic_id = logic_id; //workplace->get_logic_item(logic_id)->set_out_connected(true); - tmp_line.store_id = workplace->get_item_id(otro); - std::cout << otro << " " << tmp_line.logic_id << " " << tmp_line.store_id << std::endl; - workplace->lista_lineas_in.push_back(tmp_line); + if (workplace->get_item_id(otro) != -1) { + tmp_line.store_id = workplace->get_item_id(otro); + std::cout << otro << " se conecta a una compuerta" << std::endl; + workplace->lista_lineas_in.push_back(tmp_line); + } else { + /* Como no era un item, debe ser una compuerta */ + tmp_line.store_id = workplace->get_logic_id(otro); + workplace->lista_lineas_logic.push_back(tmp_line); + } } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada")==0) { otro = (char *)XML_GET_CONTENT(nodo->children); t_line tmp_line; tmp_line.logic_id = logic_id; - tmp_line.store_id = workplace->get_item_id(otro); - workplace->lista_lineas_out.push_back(tmp_line); - std::cout << otro << " " << tmp_line.logic_id << " " << tmp_line.store_id << std::endl; + if (workplace->get_item_id(otro) != -1) { + tmp_line.store_id = workplace->get_item_id(otro); + /* Tengo que ver si es un tanque, para setearlo correctamente */ + if (dynamic_cast(workplace->get_item(workplace->get_item_id(otro)))) { + std::string donde = (char *)xmlGetProp(nodo, BAD_CAST"id"); + tmp_line.cistern_out1 = true; + if (donde == "inferior") { + tmp_line.cistern_out1 = false; + } + } + workplace->lista_lineas_out.push_back(tmp_line); + std::cout << otro << " se conecta a una compuerta" << std::endl; + } else { + /* Como no era un item, debe ser una compuerta */ + tmp_line.store_id = workplace->get_logic_id(otro); + workplace->lista_lineas_logic.push_back(tmp_line); + } } } nodo = nodo->next;