summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-05-09 21:55:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-11 07:57:09 -0700
commit698b2b133fb43cfa2c28f7639662f3d787627c30 (patch)
tree2583da7e9a7f19e67793e1f261f70457e0ed2c65 /qt-ui/diveplanner.cpp
parent3edec7c97dac71f288d65fd0e86fc14c69649d9d (diff)
downloadsubsurface-698b2b133fb43cfa2c28f7639662f3d787627c30.tar.gz
Only add disclaimer and runtime table if we added deco to replanne dive
As a side effect this changes the signature of plan(): Before it returned an int that was supposed to be possibly an error but we never bothered to check it. So now it's bool indicating if the planner did add stops. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index aacca8e8f..a5fc512cb 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -1310,7 +1310,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
plannerModel->setRecalc(oldRecalc);
//TODO: C-based function here?
- plan(&diveplan, &cache, isPlanner(), true);
+ bool did_deco = plan(&diveplan, &cache, isPlanner(), true);
if (!current_dive || displayed_dive.id != current_dive->id) {
// we were planning a new dive, not re-planning an existing on
record_dive(clone_dive(&displayed_dive));
@@ -1331,7 +1331,8 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
QString oldnotes(current_dive->notes);
if (oldnotes.indexOf(QString(disclaimer)) >= 0)
oldnotes.truncate(oldnotes.indexOf(QString(disclaimer)));
- oldnotes.append(displayed_dive.notes);
+ if (did_deco)
+ oldnotes.append(displayed_dive.notes);
displayed_dive.notes = strdup(oldnotes.toUtf8().data());
}
copy_dive(&displayed_dive, current_dive);