X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/cafdb587ee6e195e5a917cea7570c2ea7e22a003..325f784cbf310091cb5749842a52cf7e1ad64b1b:/Model/src/exclusa.cpp diff --git a/Model/src/exclusa.cpp b/Model/src/exclusa.cpp index 8e64bc3..89554f8 100644 --- a/Model/src/exclusa.cpp +++ b/Model/src/exclusa.cpp @@ -31,6 +31,11 @@ void Exclusa::update(int dir) void Exclusa::simulate() { + std::list::iterator i = in_list.begin(); + if (i != in_list.end()) { + PlantItem *o = (PlantItem *)(*i); + set_color( o->get_color() ); + } std::cout << name << ": " << ((is_open)?"Abierta":"Cerrada") << std::endl; } @@ -39,11 +44,13 @@ void Exclusa::recieve_msg(int msg, IConector *who, void *data) switch (msg) { case MSG_QUERY_MAX_FLOW_OUT: temp = *((float *)data); + if (!is_open) temp = 0; send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &temp); who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &temp); break; case MSG_RESPONSE_MAX_FLOW: - temp = *((float *)data); + if (is_open) + temp = *((float *)data); break; default: Control::recieve_msg(msg, who, data);