mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Desktop: use local variable instead of displayed_dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6619bd972c
commit
4b0f90ced3
1 changed files with 10 additions and 11 deletions
|
@ -965,18 +965,17 @@ void MainWindow::on_actionAddDive_triggered()
|
||||||
|
|
||||||
// create a dive an hour from now with a default depth (15m/45ft) and duration (40 minutes)
|
// create a dive an hour from now with a default depth (15m/45ft) and duration (40 minutes)
|
||||||
// as a starting point for the user to edit
|
// as a starting point for the user to edit
|
||||||
clear_dive(&displayed_dive);
|
struct dive d = { 0 };
|
||||||
displayed_dive.id = dive_getUniqID();
|
d.id = dive_getUniqID();
|
||||||
displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
d.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
||||||
displayed_dive.dc.duration.seconds = 40 * 60;
|
d.dc.duration.seconds = 40 * 60;
|
||||||
displayed_dive.dc.maxdepth.mm = M_OR_FT(15, 45);
|
d.dc.maxdepth.mm = M_OR_FT(15, 45);
|
||||||
displayed_dive.dc.meandepth.mm = M_OR_FT(13, 39); // this creates a resonable looking safety stop
|
d.dc.meandepth.mm = M_OR_FT(13, 39); // this creates a resonable looking safety stop
|
||||||
displayed_dive.dc.model = strdup("manually added dive"); // don't translate! this is stored in the XML file
|
d.dc.model = strdup("manually added dive"); // don't translate! this is stored in the XML file
|
||||||
displayed_dive.duration = displayed_dive.dc.duration;
|
fake_dc(&d.dc);
|
||||||
fake_dc(&displayed_dive.dc);
|
fixup_dive(&d);
|
||||||
fixup_dive(&displayed_dive);
|
|
||||||
|
|
||||||
Command::addDive(&displayed_dive, autogroup, true);
|
Command::addDive(&d, autogroup, true);
|
||||||
|
|
||||||
// Plot dive actually copies current_dive to displayed_dive and therefore ensures that the
|
// Plot dive actually copies current_dive to displayed_dive and therefore ensures that the
|
||||||
// correct data are displayed!
|
// correct data are displayed!
|
||||||
|
|
Loading…
Add table
Reference in a new issue