mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
When adding a waypoint, use the gasmix of the _next_ waypoint.
This corrects the logic of adding a waypoint actually meaning that a previous segment is subdivided into two. Both new segments should by default use the gas of the old one. Since the gas is stored in the waypoint (divedatapoint) at the end, we need to use the _next_ gas. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
79cd5ce835
commit
b0da8c2707
1 changed files with 7 additions and 12 deletions
|
@ -833,20 +833,15 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in,
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Previous, actually means next as we are typically subdiving a segment and the gas for
|
||||
// the segment is determined by the waypoint at the end.
|
||||
if (usePrevious) {
|
||||
if (row > 0) {
|
||||
gas = divepoints.at(row - 1).gasmix;
|
||||
if (row < divepoints.count()) {
|
||||
gas = divepoints.at(row).gasmix;
|
||||
} else {
|
||||
// when we add a first data point we need to make sure that there is a
|
||||
// tank for it to use;
|
||||
// first check to the right, then to the left, but if there's nothing,
|
||||
// we simply default to AIR
|
||||
if (row < divepoints.count()) {
|
||||
gas = divepoints.at(row).gasmix;
|
||||
} else {
|
||||
if (!addGas(air))
|
||||
qDebug("addGas failed"); // FIXME add error propagation
|
||||
}
|
||||
if (!addGas(air))
|
||||
qDebug("addGas failed"); // FIXME add error propagation
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue