X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/6f0378c3b23f392a1f342106932a90486bd05dbc..f29a7129de56edca96ea8ef58576898c1e52ed6f:/Model/src/simulador.cpp?ds=sidebyside 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; +} +