summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-28 13:35:04 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-28 13:37:14 -0700
commita4608f7c91138401e9987ff0478bbe42408a37a7 (patch)
treec9f48cf556a1ca39604fe5045acfe2e44087b38e /printer.cpp
parentbe47ce624170cfce7e9763e5530f0be3555c187d (diff)
downloadsubsurface-a4608f7c91138401e9987ff0478bbe42408a37a7.tar.gz
Printing: fix dive lookup for profile generation
The existing code (and templates) looked up dives by number and then used that as index into the dive table. This worked exactly in one case: if all dives were numbered consecutively starting with 1. While that is not an entirely unreasonable case, it's of course not an acceptable assumption to make. This commit adds the necessary changes to instead look up dives by their unique id. That's what it's there fore, after all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/printer.cpp b/printer.cpp
index 10942865a..fcafaa38e 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -92,8 +92,9 @@ void Printer::render(int Pages = 0)
// render all the dive profiles in the current page
while (elemNo < collection.count() && collection.at(elemNo).geometry().y() < viewPort.y() + viewPort.height()) {
// dive id field should be dive_{{dive_no}} se we remove the first 5 characters
- int diveNo = collection.at(elemNo).attribute("id").remove(0, 5).toInt(0, 10);
- putProfileImage(collection.at(elemNo).geometry(), viewPort, &painter, get_dive(diveNo - 1), profile);
+ QString diveIdString = collection.at(elemNo).attribute("id");
+ int diveId = diveIdString.remove(0, 5).toInt(0, 10);
+ putProfileImage(collection.at(elemNo).geometry(), viewPort, &painter, get_dive_by_uniq_id(diveId), profile);
elemNo++;
}