本文整理汇总了C++中Road::addCarToQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::addCarToQueue方法的具体用法?C++ Road::addCarToQueue怎么用?C++ Road::addCarToQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::addCarToQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TAToQueues
void TAToQueues(Road& R, int timestep) {
vector<int> carsToErase;
for(vector<Car>::iterator it = R.getTA().begin() ; it != R.getTA().end() ; it++) {
it->iterProg(0);
if(it->distanceInTA() < R.distanceToTravelInTA((*it))) // The car has to reach its queue (Individual or common)
it->iterDistanceInTA(R.speedMax()*timestep);
// !!! SOME TIME IS ADDED TO FAKE THE FACT THAT THE CAR WAS NOT TRAVELING AT VMAX
// !!! BUT, BESIDES THE TIME ADDED< THE CAR SHOULD REALLY WAIT THIS TIME AND NOT BE IN THE SYSTEM ANYMORE
else { // The car has reached its queue (Individual or common)
it->initDistanceInTA(); //The traveled distance is initialized
int addedTime = timeToAdd(R.speedMax(), it->accMax(), it->distanceInTA() ); //Some time is added to the cars
for(int i = 0; i<addedTime ; i++) { it->iterProg(0); }
carsToErase.push_back(it->number());
R.addCarToQueue((*it));
}
}
R.removeCarsFromTA(carsToErase);
}