]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
* Se arregla la union, por n-esima vez, para que actualice correctamente los flujos.
authorRicardo Markiewicz <gazer.arg@gmail.com>
Mon, 1 Dec 2003 00:40:14 +0000 (00:40 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Mon, 1 Dec 2003 00:40:14 +0000 (00:40 +0000)
 * Se corrige un bug en el tanque para que los items conectados a la salida
   calculen bien el color  (especialmente al union)

 Ahora el ejemplo muchoscolores.xml deberia andar 10 puntos.

Model/src/tank.cpp
Model/src/union.cpp

index a557c0b5cf83b8094bf7951867ede32ae4e8bd44..0a83de3c5ad1ed1047683f75f533c79a14c57bbb 100644 (file)
@@ -67,7 +67,7 @@ void Tank::recieve_msg(int msg, IConector *who, void *data)
                        actual_in_flow = capacity - litros;
                        if (*((float *)data) < actual_in_flow)
                                actual_in_flow = *((float *)data);
-                       actual_out_flow = litros;
+                       actual_flow = actual_out_flow = litros;
                        updated = true;
                        send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_out_flow);
 
@@ -76,7 +76,7 @@ void Tank::recieve_msg(int msg, IConector *who, void *data)
                case MSG_RESPONSE_MAX_FLOW:
                        if (pos == OUT) {
                                if (*((float *)data) < actual_out_flow)
-                                       actual_out_flow = *((float *)data);
+                                       actual_flow = actual_out_flow = *((float *)data);
                        }
                break;
                case MSG_RESPONSE_COLOR:
index 0d2c18c85e8fc8798113c3fee616fe5fd41827ff..a9397ddf10202b10cdc17b7b0c3eec9ea6700162 100644 (file)
@@ -50,11 +50,20 @@ void Union::recieve_msg(int msg, IConector *who, void *data)
                                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;
+                               switch (in_on_zero) {
+                                       case 1:
+                                               if (in_ready == 0)
+                                                       tmp = max_flow;
+                                               else
+                                                       tmp = actual_flow/2.0f;
+                                       break;
+                                       case 0:
+                                               if (in_ready == 1) {
+                                                       tmp = actual_flow/2.0f;
+                                               }
+                                       break;
+                                       case 2:
+                                               tmp = 0.0f;
                                }
                                send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &tmp);
                        } else {
@@ -72,8 +81,7 @@ void Union::recieve_msg(int msg, IConector *who, void *data)
                                        case 2:
                                                actual_flow = 0;
                                }
-                               if (!updated)
-                                       send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
+                               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);
                        }