mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Remove gasmix_is_null
The semantic of fo2==fhe==0 to mean "same gasmix as before" apparently is not used anywhere and gets in the way of the semantic "this is air". If there is really need for mix meaning "same as before", please use another value, e.g. one with a specific negative percentage. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aafd918169
commit
79cd5ce835
2 changed files with 1 additions and 14 deletions
8
dive.h
8
dive.h
|
@ -124,14 +124,6 @@ static inline bool gasmix_is_air(const struct gasmix *gasmix)
|
|||
return (he == 0) && (o2 == 0 || ((o2 >= O2_IN_AIR - 1) && (o2 <= O2_IN_AIR + 1)));
|
||||
}
|
||||
|
||||
/* in the planner we use a null gasmix to indicate that we keep using the gas as before
|
||||
* this is BAD as a null gasmix can also be interpreted as air.
|
||||
* DANGER DANGER DANGER */
|
||||
static inline bool gasmix_is_null(const struct gasmix *gasmix)
|
||||
{
|
||||
return gasmix->he.permille == 0 && gasmix->o2.permille == 0;
|
||||
}
|
||||
|
||||
/* Linear interpolation between 'a' and 'b', when we are 'part'way into the 'whole' distance from a to b */
|
||||
static inline int interpolate(int a, int b, int part, int whole)
|
||||
{
|
||||
|
|
|
@ -292,8 +292,6 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
|||
dp = dp->next;
|
||||
continue;
|
||||
}
|
||||
if (gasmix_is_null(&gasmix))
|
||||
gasmix = oldgasmix;
|
||||
|
||||
/* Check for SetPoint change */
|
||||
if (oldpo2 != po2) {
|
||||
|
@ -566,11 +564,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
nextdp = dp->next;
|
||||
while (nextdp && nextdp->time == 0)
|
||||
nextdp = nextdp->next;
|
||||
if (nextdp) {
|
||||
if (nextdp)
|
||||
newgasmix = nextdp->gasmix;
|
||||
if (gasmix_is_null(&newgasmix))
|
||||
newgasmix = gasmix;
|
||||
}
|
||||
/* do we want to skip this leg as it is devoid of anything useful? */
|
||||
if (!dp->entered &&
|
||||
gasmix_distance(&gasmix, &newgasmix) == 0 &&
|
||||
|
|
Loading…
Reference in a new issue