- void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
- {
- NetworkConstantAction *action = nullptr;
- ActionList *actionSet = getRunningActionSet();
- for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
- ; it != itend ; it=itNext) {
- ++itNext;
- action = static_cast<NetworkConstantAction*>(&*it);
- if (action->latency_ > 0) {
- if (action->latency_ > delta) {
- double_update(&(action->latency_), delta, sg_surf_precision);
- } else {
- action->latency_ = 0.0;
- }
- }
- action->updateRemains(action->getCost() * delta / action->initialLatency_);
- if (action->getMaxDuration() != NO_MAX_DURATION)
- action->updateMaxDuration(delta);
+double NetworkConstantModel::nextOccuringEvent(double /*now*/)
+{
+ double min = -1.0;
+ for (Action const& action : *getRunningActionSet()) {
+ const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
+ if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
+ min = net_action.latency_;
+ }
+ return min;
+}