X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/cabbbca66d9966213bb6e207046a605b5d0b7332..d53ded00c10a30a17c7f0aad90acca933a7f4db9:/Model/src/simulador.cpp?ds=inline diff --git a/Model/src/simulador.cpp b/Model/src/simulador.cpp index 23fe950..b3a93b1 100644 --- a/Model/src/simulador.cpp +++ b/Model/src/simulador.cpp @@ -59,6 +59,9 @@ void Simulador::add_exclusa(const std::string &name) void Simulador::add_tank(const std::string &name) { 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); } @@ -117,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; +} +