X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/78a6866a5076cee1015d8985b5bbbb84adf32576..HEAD:/Model/src/simulator.cpp diff --git a/Model/src/simulator.cpp b/Model/src/simulator.cpp index 7811d4e..6a85446 100644 --- a/Model/src/simulator.cpp +++ b/Model/src/simulator.cpp @@ -597,7 +597,7 @@ void Simulator::connect_logic(LogicControl *current, xmlNodePtr nodo) if (xmlStrcmp(nodo->name, BAD_CAST"entrada") == 0) { item = dynamic_cast(find((char *)XML_GET_CONTENT(nodo->children))); if (item != NULL) { - if (dynamic_cast(item)) { + if (dynamic_cast(item) != NULL) { std::string donde = (char *)xmlGetProp(nodo, BAD_CAST"id"); if (donde == "inferior") { current->connect( item->get_logic_output(), IConector::IN ); @@ -608,7 +608,13 @@ void Simulator::connect_logic(LogicControl *current, xmlNodePtr nodo) current->connect( item->get_logic_output(), IConector::IN ); } } else { - std::cout << "ERROR : Item no es tipo Control!!" << std::endl; + LogicControl *logic = dynamic_cast(find_logic((char *)XML_GET_CONTENT(nodo->children))); + /* Bien, si no era un control, debe ser una compuerta */ + if (logic != NULL) { + current->connect(logic, IConector::IN); + } else { + std::cout << "ERROR : Item no es tipo Control ni tipo LogicControl ... esto si que esta todo malllll!!" << std::endl; + } } } else if (xmlStrcmp(nodo->name, BAD_CAST"salida") == 0) { item = dynamic_cast(find((char *)XML_GET_CONTENT(nodo->children)));