X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/a8803d96a8a33195ae9234b5e6ea84d7eefa0fd9..f61a5ebd00d4620af70c3780ba821f5af68def1c:/Model/src/conduct.cpp?ds=inline diff --git a/Model/src/conduct.cpp b/Model/src/conduct.cpp index 02fe3a6..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; } @@ -55,13 +52,8 @@ void Conduct::update(int dir) // Seteo mi actualizar en true para evitar entrar de nuevo 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() @@ -71,14 +63,13 @@ void Conduct::simulate() 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; } -void Conduct::get_state_as_xml(std::stringstream &out) -{ - out << "\t" << std::endl; - out << "\t\t" << actual_flow << "" << std::endl; - out << "\t" << std::endl; -}