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);
}
return NULL;
}
+bool Simulador::pump_deactivate(const std::string &name)
+{
+ // Busco el elemento, usando RTTI :-(
+ Pump *pump = dynamic_cast<Pump *>(find(name));
+
+ if (!pump) {
+ // Ups!, "name" no era un Pump!!!
+ return false;
+ }
+ pump->deactivate();
+ return true;
+}
+