mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: track gas consumption in cylinders and samples
This commit is a little bigger than I usually prefer, but it's all somewhat interconnected. - we pass around the cylinders throughout the planning process and as we create the plan we calculate the gas consumption in every segment and track this both in the end pressure of the cylinder and over time in the samples - because of that we no longer try to calculate the gas consumption after being done planning; we just use what we calculated along the way - we also no longer add gases during the planning process - all gases have to come from the list of cylinders passed in (which makes sense as we should only use those gases that the user added in the UI or inherited from a the selected dive (when starting to plan with a dive already selected) With this patch I think we are close do being able to move all of the planning logic back into the planner.c code where it belongs. The one issue that still bothers me is that we are juggling so many dive structures and then keep copying content around. It seems like we should be able to reduce that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
56395b3894
commit
d054e8c457
4 changed files with 85 additions and 69 deletions
|
|
@ -181,3 +181,12 @@ void remove_weightsystem(struct dive *dive, int idx)
|
|||
memmove(ws, ws + 1, nr * sizeof(*ws));
|
||||
memset(ws + nr, 0, sizeof(*ws));
|
||||
}
|
||||
|
||||
void reset_cylinders(struct dive *dive)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_CYLINDERS; i++) {
|
||||
if (dive->cylinder[i].type.workingpressure.mbar)
|
||||
dive->cylinder[i].start.mbar = dive->cylinder[i].end.mbar = dive->cylinder[i].type.workingpressure.mbar;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue