X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/0ed3ebf8af491d51f1d7e5226fce6ea7cf56bf2d..44617167ac216781537290dce9cc097df89dc3d2:/Model/src/simulator.cpp?ds=sidebyside diff --git a/Model/src/simulator.cpp b/Model/src/simulator.cpp index ac03b47..be68005 100644 --- a/Model/src/simulator.cpp +++ b/Model/src/simulator.cpp @@ -539,6 +539,9 @@ std::string Simulator::get_state_as_xml() for(i2=items.begin(); i2!=items.end(); i2++) (*i2)->get_state_as_xml(out); + std::list::iterator i3; + for(i3=control_lst.begin(); i3!=control_lst.end(); i3++) + (*i3)->get_state_as_xml(out); out << ""; return out.str();; } @@ -605,14 +608,26 @@ 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))); if (item != NULL) { item->get_logic_input()->connect( current, 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) { + logic->connect(current, IConector::IN); + } else { + std::cout << "ERROR : Item no es tipo Control ni tipo LogicControl ... esto si que esta todo malllll!!" << std::endl; + } } }