ctrl k
  • service/src/simulationmodel/SimulationModel.cc
    ■ ■ ■ ■ ■ ■
    skipped 41 lines
    42 42   
    43 43   std::string type = entity["type"];
    44 44   if (type == "recharge_station") {
    45  - rechargeStations.push_back(myNewEntity->getPosition());
     45 + rechargeStations.push_back(myNewEntity->getPosition());
    46 46   } else if (type == "drone") {
    47  - myNewEntity = new DroneBatteryDecorator(
    48  - dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
    49  - entities[myNewEntity->getId()] = myNewEntity;
    50  - // update the entity in the map
    51  - // myNewEntity->addObserver(this)
    52  - // sending low battery notifications
     47 + // Allow drone to send notifications even with decorator
     48 + myNewEntity = new DroneBatteryDecorator(
     49 + dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
     50 + entities[myNewEntity->getId()] = myNewEntity;
    53 51   }
    54 52   }
    55 53   
    skipped 94 lines
  • service/src/simulationmodel/entity/decorator/DroneBatteryDecorator.cc
    ■ ■ ■ ■
    skipped 26 lines
    27 27   bool createMessage = currentCharge % 20 == 0;
    28 28   
    29 29   
     30 + // Create message to show the drone's charge ever 20%
    30 31   if (createMessage) {
    31 32   std::string message = getName() + " now at " +
    32 33   std::to_string(currentCharge) + "% charge";
    skipped 89 lines
    122 123   
    123 124   distanceToDestination =
    124 125   strategy->totalPathDistance(currentPosition);
    125  - 
    126 126   
    127 127   } else if (sub->getToFinalDestinationStrategy()) {
    128 128   droneIdleTime = 0;
    skipped 82 lines
Page is in error, reload to recover