本文整理汇总了C++中Road::getTimeSlice方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::getTimeSlice方法的具体用法?C++ Road::getTimeSlice怎么用?C++ Road::getTimeSlice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::getTimeSlice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: advanceCars
void Junction::advanceCars(){
Road* r = getCurrentRoad();
if(r != 0){
if(r->getTimeRemainToRedLight() > 0){
r->setGreenLight(true);
if(r->getNoOfCars() > 0){
Car* last_car = r->getLastNotFaultyCar();
if(last_car != 0 && last_car->getLocation() == r->getLength()){
getCurrentRoad()->removeCar(last_car);
if(last_car->getNextRoad() != 0){
last_car->getNextRoad()->addCar(last_car);
}else{
last_car->carFinishedTheRoad();
}
r->addPassedCar();
last_car->moveIndexToNextRoad();
}
}
r->decreaseTimeRemainToRedLight();
if(r->getTimeRemainToRedLight() == 0){
r->setGreenLight(false);
moveToNextRoad();
getCurrentRoad()->setGreenLight(true);
r->setTimeSlice(Road::getUpdatedTimeSlice(r->getNoOfCarsPassed(),r->getTimeSlice(),r->getSimulator()->getMaxTimeSlice(),r->getSimulator()->getMinTimeSlice()));
r->resetPassedCars();
}
}
}
}