- tmp = (actual_flow<max_flow)?actual_flow:max_flow;
- if (pos == IN) {
- // Si esta conectado a mi entrada, le puedo aceptar
- // solo la mitad del flujo maximo
- tmp /= 2;
+ if (updated) {
+ float tmp = actual_flow/2.0f;
+ who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &tmp);
+ break;
+ }
+ updated = true;
+ if (m_data == 0) {
+ in_on_zero++;
+ tmp = 0.0f;
+ who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &tmp);
+ if (in_on_zero == 1) {
+ if (in_ready == 0)
+ tmp = max_flow;
+ else
+ tmp = actual_flow/2.0f;
+ }
+ send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &tmp);
+ } else {
+ switch (in_on_zero) {
+ case 0:
+ actual_flow = (m_data<actual_flow)?m_data:actual_flow;
+ actual_flow = (actual_flow<max_flow)?actual_flow:max_flow;
+ break;
+ case 1:
+ if (in_ready == 1)
+ actual_flow = actual_flow/2.0f;
+ else
+ actual_flow = max_flow/2.0f;
+ break;
+ case 2:
+ actual_flow = 0;
+ }
+ send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
+ tmp = (in_on_zero==0)?actual_flow/2.0f:actual_flow;
+ who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &tmp);