From 0fd026d28d1b5a8cb97b476859fa2554bee6ae30 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 2 Sep 2016 19:31:58 +0200 Subject: [PATCH] fix a pair of bugs in storageN11 --- src/surf/storage_n11.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index e23abc2c8a..21fbb424d6 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -174,17 +174,15 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta) action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta); - if (action->getMaxDuration() != NO_MAX_DURATION) + if (action->getMaxDuration() > NO_MAX_DURATION) action->updateMaxDuration(delta); if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 && action->p_storage->usedSize_ == action->p_storage->size_) { action->finish(); action->setState(Action::State::failed); - } else if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) { - action->finish(); - action->setState(Action::State::done); - } else if ((action->getMaxDuration() != NO_MAX_DURATION) && (action->getMaxDuration() <= 0)) { + } 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); } -- 2.20.1