Car.hpp 907 Bytes
Newer Older
Martin Kröning's avatar
Martin Kröning committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#pragma once

#include "Vehicle.hpp"
#include <string>
class MapAppABIWrapper;

class Car : public Vehicle {
public:
  /// The fuel tank is half full at construction
  Car(std::string name, double topSpeed, double timeOfStart, double fuelConsumption,
      double fuelCapacity, double time);

  void draw(MapAppABIWrapper &mapApp, const std::string &laneName,
            double laneLength, double speedLimit) const override;

  double getSpeed(double speedLimit) const override;

  void process(double time, double maximumDistanceOnLane,
               double speedLimit) override;

  /// Refuels the vehicle provided the \p availableFuel in l
  /// \returns The amount of fuel in l that has been taken
  double refuel(double availableFuel);

private:
  /// Fuel consumption in l/100km
  double fuelConsumption;

  /// Fuel capacity in l
  double fuelCapacity;

  /// Remaining fuel in l
  double fuel;
};