X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/f5a1e732bf3907cabd004932aba3256b31d9d282..ed2cb04e907c90998221e00fcac1ded840ce693c:/Model/src/conduct.cpp?ds=inline diff --git a/Model/src/conduct.cpp b/Model/src/conduct.cpp index 63cd7e9..bc0e3f3 100644 --- a/Model/src/conduct.cpp +++ b/Model/src/conduct.cpp @@ -5,12 +5,12 @@ using namespace PlaQui::Model; Conduct::Conduct(const std::string &_name):Transport(_name) { - max_flow = actual_flow = 0.0f; + max_flow = 0.0f; // Inicio los parametros de conectores in_slots = 1; out_slots = 1; - actual_flow = 9999; + actual_flow = 99999; } Conduct::~Conduct() @@ -24,13 +24,10 @@ void Conduct::recieve_msg(int msg, IConector *who, void *data) // Me preguntan por el flujo máximo. // Primero me actualizo, y luego respondo float tmp = *((float *)data); - // update(); actual_flow = (actual_flow>max_flow)?max_flow:actual_flow; actual_flow = (actual_flowrecieve_msg(MSG_RESPONSE_MAX_FLOW, this, &actual_flow); updated = true; } @@ -53,32 +50,26 @@ void Conduct::update(int dir) // Si ya me actualice, no lo tengo que hacer de nuevo if (updated) return; // Seteo mi actualizar en true para evitar entrar de nuevo -// actual_flow = 99999; + actual_flow = 99999; updated = true; - switch (dir) { - case IN: - send_msg(IN, MSG_QUERY_MAX_FLOW_IN, (void *)&max_flow); - break; - case OUT: - send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, (void *)&max_flow); - } + actual_flow = max_flow; + send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, (void *)&actual_flow); } void Conduct::simulate() { if (!updated) { + std::cout << name << "::sin actualizar!" << std::endl; return; } - std::cout << name << "::Flujo actual = " << actual_flow << std::endl; + std::list::iterator i = in_list.begin(); + if (i != in_list.end()) { + PlantItem *o = (PlantItem *)(*i); + set_color( o->get_color() ); + } + std::cout << name << "::Flujo actual = " << actual_flow << " de " << max_flow << std::endl; updated = false; - actual_flow = 99999; } -void Conduct::get_state_as_xml(std::stringstream &out) -{ - out << "\t" << std::endl; - out << "\t\t" << actual_flow << "" << std::endl; - out << "\t" << std::endl; -}