- double current_progress = lrint(lmm_variable_getvalue(action->getVariable()) * delta);
-
- action->updateRemains(current_progress);
- if (action->type_ == WRITE) {
- action->storage_->usedSize_ += current_progress;
- action->file_->incrPosition(current_progress);
- action->file_->setSize(action->file_->tell());
-
- action->storage_->getContent()->erase(action->file_->cname());
- action->storage_->getContent()->insert({action->file_->cname(), action->file_->size()});
- }
-
- if (action->getMaxDuration() > NO_MAX_DURATION)
- action->updateMaxDuration(delta);
-
- if (action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 &&
- action->storage_->usedSize_ == action->storage_->getSize()) {
- action->finish();
- action->setState(Action::State::failed);
- } else if (((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) ||
- ((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
- action->finish();
- action->setState(Action::State::done);
+ if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
+ ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+ action.finish(Action::State::done);