]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Model/src/union.cpp
* Todos los items, menos el tanque, ya actualizan bien los colores
[z.facultad/75.42/plaqui.git] / Model / src / union.cpp
index baf3cc3a4f2593efede6827a4f95bc45a31813c0..5f22ef59d7c726b9f508de17329d4e0d25c7d170 100644 (file)
@@ -105,10 +105,25 @@ void Union::update(int dir)
 
 void Union::simulate()
 {
+       RGB c_in1, c_in2;
+       unsigned r,g,b;
+
        if (!updated) {
                return;
        }
+       std::list<IConector *>::iterator i = in_list.begin();
+       if (i != in_list.end()) {
+               PlantItem *o = (PlantItem *)(*i);
+               c_in1 = o->get_color();
+               i++;
+               o = (PlantItem *)(*i);
+               c_in2 = o->get_color();
+       }
 
+       r = ((c_in1.r()+c_in2.r())/2)%256;
+       g = ((c_in1.g()+c_in2.g())/2)%256;
+       b = ((c_in1.b()+c_in2.b())/2)%256;
+       set_color(RGB(r,g,b));
        std::cout << name << "::Flujo actual = " << actual_flow << std::endl;
        updated = false;
        in_on_zero = 0;