aboutsummaryrefslogtreecommitdiffstats
path: root/core/planner.h
AgeCommit message (Collapse)Author
2019-09-10Cleanup: remove global disclaimer variableGravatar Berthold Stoeger
That was used to store the disclaimer of the last plan. The functionality was disfunctional for a long time, therefore remove the variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10Plan: introduce function that returns disclaimerGravatar Berthold Stoeger
The setting of the disclaimer variable was removed inadvertently some time ago, which removed the disclaimer from the printed plan. Instead, introduce a function that returns the disclaimer with the current deco mode. Use that function to generate the dive notes and for printing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10Planner: remove planner disclaimer from old notesGravatar Berthold Stoeger
There used to be code to remove the old planner notes when replanning a dive. It used a global variable and seemed rather brittle. Moreover, the place that set the global variable was inadvertently removed. Therefore has been effectively dead code. Reimplement the functionality, but be more robust by considering that the deco-type may have changed: Split the translated disclaimer string in two parts, before and after the "%s" place-holder. Search for these two parts. Remove the disclaimer and everything after the disclaimer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move planner/deco related declarations planner/deco.hGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused global variables plangflow and plangfhighGravatar Berthold Stoeger
The last user was removed in 1093d6235b5657746f2cb4524ed08cf13c80c3bb. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: pass gasmix by valueGravatar Berthold Stoeger
In a previous commit, the get_gasmix_* functions were changed to return by value. For consistency, also pass gasmix by value. Note that on common 64-bit platforms struct gasmix is the size of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the same space on the stack. On 32-bit platforms, the stack use is probably doubled, but in return a dereference is avoided. Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an invasive change that going back to pointers is probably the least of our worries. This commit is a step in const-ifying input parameters (passing by value is the ultimate way of signaling that the input parameter will not be changed [unless there are references to said parameter]). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: unify get_gas_at_time() and get_gasmix()Gravatar Berthold Stoeger
There were two functions for getting gas-mixes at a certain timestamp: - get_gasmix() for repeated queries. - get_gas_at_time() for a single query. Since the latter is a special case of the former, simply call the former in the latter. Moreover, rename to get_gasmix_at_time() for consistency. Replace on get_gasmix() call, which was outside of a loop by the corresponding get_gasmix_at_time() call. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-05-26Move planner notes to separate fileGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-29Add SPDX header to core C filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-28Handle notes in replanGravatar Robert C. Helling
Upon replanning a dive, we want to delete the old dive plan in the notes and replace it with the actual. This fixes a problem when we failed to detect the old plan due to the deco model name appearing in the disclaimer that was used as a marker for the notes. This patch also adds translation markers for the deco model name strings.. Fixes #285 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-07-09Have divedatapoint store cylinder id instead of gasmixGravatar Rick Walsh
Determining the correct cylinder index from a known gas mix can be complicated, but it is trivial to look up the gasmix from the cylinder_t structure. It makes sense to remember which cylinder is being used. This simplifies handling changing a cylinder's gas mix, either directly by the user, or indirectly in the planner. It also permits tracking of multiple cylinders of the same mix, e.g. independent twins / sidemount. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>