X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/950f83d0e71dc886fcf5be9889796c5b2a85fa4c..2d7fff39ec5ab67f13b5250a60082c4bc62c1739:/Model/src/union.cpp diff --git a/Model/src/union.cpp b/Model/src/union.cpp index baf3cc3..5f22ef5 100644 --- a/Model/src/union.cpp +++ b/Model/src/union.cpp @@ -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::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;