mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move get_or_create_cylinder() to struct dive
Other cylinder-creation functions were already there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
777e7f32a5
commit
9bb2255ba8
12 changed files with 83 additions and 83 deletions
|
@ -359,6 +359,17 @@ int dive::get_cylinder_index(const struct event &ev) const
|
|||
return best < 0 ? 0 : best;
|
||||
}
|
||||
|
||||
cylinder_t *dive::get_or_create_cylinder(int idx)
|
||||
{
|
||||
if (idx < 0) {
|
||||
report_info("Warning: accessing invalid cylinder %d", idx);
|
||||
return NULL;
|
||||
}
|
||||
while (static_cast<size_t>(idx) >= cylinders.size())
|
||||
add_empty_cylinder(&cylinders);
|
||||
return &cylinders[idx];
|
||||
}
|
||||
|
||||
/* Are there any used cylinders which we do not know usage about? */
|
||||
static bool has_unknown_used_cylinders(const struct dive &dive, const struct divecomputer *dc,
|
||||
const bool used_cylinders[], int num)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue