ctrl k
  • service/src/simulationmodel/SimulationModel.cc
    ■ ■ ■ ■
    skipped 5 lines
    6 6  #include "PackageFactory.h"
    7 7  #include "RobotFactory.h"
    8 8  #include "RechargeStationFactory.h"
     9 +#include "DroneBatteryDecorator.h"
    9 10   
    10 11  SimulationModel::SimulationModel(IController& controller)
    11 12   : controller(controller) {
    skipped 30 lines
    42 43   std::string type = entity["type"];
    43 44   if (type == "recharge_station") {
    44 45   rechargeStations.push_back(myNewEntity->getPosition());
    45  - std::cout << "Position: " << myNewEntity->getPosition()[0] << ", " << myNewEntity->getPosition()[1] << ", " << myNewEntity->getPosition()[2] << std::endl;
     46 + } else if (type == "drone") {
     47 + myNewEntity = new DroneBatteryDecorator(dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
     48 + // myNewEntity->addObserver(this); // sending low battery notifications
    46 49   }
    47 50   }
    48 51   
    skipped 94 lines
  • service/src/simulationmodel/entity/decorator/DroneBatteryDecorator.cc
    ■ ■ ■ ■
    skipped 102 lines
    103 103   toRechargeStation = nullptr;
    104 104   }
    105 105   } else if (droneReady) {
    106  - DroneDecorator::update(dt);
     106 + sub->update(dt);
    107 107   }
    108 108   
    109 109   if (isAtRechargeStation() && notCharging == false) {
    skipped 15 lines
  • service/src/simulationmodel/factory/DroneFactory.cc
    ■ ■ ■ ■
    skipped 3 lines
    4 4   std::string type = entity["type"];
    5 5   if (type.compare("drone") == 0) {
    6 6   std::cout << "Drone Created" << std::endl;
    7  - return new DroneBatteryDecorator(new Drone(entity), 100, 100, 20, 5.0);
     7 + return new Drone(entity);
    8 8   }
    9 9   return nullptr;
    10 10  }
    skipped 1 lines
Page is in error, reload to recover