Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrivalEvent.cpp:
- void ArrivalEvent::performEvent(){
- carId->currentRoad->cars.push_back(carId);
- }
- FaultEvent.cpp:
- void FaultEvent::performEvent(){
- carId->setFaultyTime(this->timeOfFault);
- }
- Car.cpp:
- bool Car::operator<(const Car& rhs)const{
- return this->distanceFrom < rhs.distanceFrom;
- }
- Car::Car(string carId, string roadPlans,&map<Road> roadsMap){
- id = carId;
- createRoadPlan(roadPlans);
- from = 0;
- faultyTimeLeft = 0;
- string start = this->roadPlan.at(0)->id;
- string end = this->roadPlan.at(1)->id;
- Road& current = roadsMap[start+","+end];
- currentRoad* = current;
- }
- void Car::setFaultyTime(int faultyTime){
- faultyTimeLeft = faultyTime;
- Car* tmpc = &this;
- currentRoad->faultyCars.push_back(tmpc);
- }
- Car.h:
- virtual bool operator<(const Car& rhs)const;
- void setFaultyTime(int faultyTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement