X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/6f0378c3b23f392a1f342106932a90486bd05dbc..a9318661e45dfb9853c6aba811670571a5ec3ea2:/Model/src/simulador.cpp diff --git a/Model/src/simulador.cpp b/Model/src/simulador.cpp index 8f8dd15..b3a93b1 100644 --- a/Model/src/simulador.cpp +++ b/Model/src/simulador.cpp @@ -58,10 +58,12 @@ void Simulador::add_exclusa(const std::string &name) void Simulador::add_tank(const std::string &name) { - //Tank *p = new Tank(name); - // FIXME no va!! - //tank_lst.push_back(p); - //items.push_back(p); + Tank *p = new Tank(name); + p->set_capacity(100); + p->set_max_flow(10); + p->set_litros(50); + tank_lst.push_back(p); + items.push_back(p); } void Simulador::add_drainage(const std::string &name) @@ -118,3 +120,16 @@ IConector *Simulador::find(const std::string &name) return NULL; } +bool Simulador::pump_deactivate(const std::string &name) +{ + // Busco el elemento, usando RTTI :-( + Pump *pump = dynamic_cast(find(name)); + + if (!pump) { + // Ups!, "name" no era un Pump!!! + return false; + } + pump->deactivate(); + return true; +} +