summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-22 22:37:43 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-22 22:37:43 -0700
commit094264014dc476942bd2cbf7709543155dad7bf4 (patch)
tree1f87df301fb89c69e12a260dfe5487a31a40cafd
parent4bdead6ad604e21a1b62be353460fce4ae0c3878 (diff)
downloadsubsurface-094264014dc476942bd2cbf7709543155dad7bf4.tar.gz
Fix helper function
Avoid counting the selected dives - we have that number. But also don't return 0 because we devide by the total work for the progress bar. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--templatelayout.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp
index 880b6d774..5f47b64a2 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -2,18 +2,13 @@
#include "templatelayout.h"
#include "helpers.h"
+#include "display.h"
int getTotalWork()
{
- int dives = 0, i;
- struct dive *dive;
- for_each_dive (i, dive) {
- //TODO check for exporting selected dives only
- if (!dive->selected)
- continue;
- dives++;
- }
- return dives;
+ // return the correct number depending on all/selected dives
+ // but don't return 0 as we might divide by this number
+ return amount_selected ? amount_selected : 1;
}
TemplateLayout::TemplateLayout(print_options *PrintOptions) :