mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:53:23 +00:00
Use get_gas_at_time in active_o2
active_o2 is now just a wrapper to return the o2 part of the active gas at a certain time. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7806dbbd9e
commit
345b01750a
1 changed files with 4 additions and 11 deletions
15
divelist.c
15
divelist.c
|
@ -42,6 +42,7 @@
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "divelist.h"
|
#include "divelist.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "planner.h"
|
||||||
|
|
||||||
static short dive_list_changed = false;
|
static short dive_list_changed = false;
|
||||||
|
|
||||||
|
@ -152,17 +153,9 @@ int total_weight(struct dive *dive)
|
||||||
|
|
||||||
static int active_o2(struct dive *dive, struct divecomputer *dc, duration_t time)
|
static int active_o2(struct dive *dive, struct divecomputer *dc, duration_t time)
|
||||||
{
|
{
|
||||||
int o2permille = get_o2(&dive->cylinder[0].gasmix);
|
struct gasmix gas = dive->cylinder[0].gasmix;
|
||||||
struct event *event;
|
get_gas_at_time(dive, dc, time, &gas);
|
||||||
|
return get_o2(&gas);
|
||||||
for (event = dc->events; event; event = event->next) {
|
|
||||||
if (event->time.seconds > time.seconds)
|
|
||||||
break;
|
|
||||||
if (strcmp(event->name, "gaschange"))
|
|
||||||
continue;
|
|
||||||
o2permille = get_o2(get_gasmix_from_event(event));
|
|
||||||
}
|
|
||||||
return o2permille;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate OTU for a dive - this only takes the first divecomputer into account */
|
/* calculate OTU for a dive - this only takes the first divecomputer into account */
|
||||||
|
|
Loading…
Add table
Reference in a new issue