mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move add_cylinder() to struct cylinder_table
Feels natural in a C++ code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
22a1120b30
commit
80b5f6bfcd
6 changed files with 12 additions and 13 deletions
|
|
@ -678,7 +678,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
|
|||
cyl.gasmix.o2.permille = (log[CMD_O2_PERCENT] / 256
|
||||
+ log[CMD_O2_PERCENT + 1]) * 10;
|
||||
cyl.gasmix.he.permille = 0;
|
||||
add_cylinder(&dive->cylinders, 0, std::move(cyl));
|
||||
dive->cylinders.add(0, std::move(cyl));
|
||||
} else {
|
||||
dc->model = "Commander";
|
||||
dc->deviceid = array_uint32_le(buf + 0x31e); // serial no
|
||||
|
|
@ -687,7 +687,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
|
|||
cyl.gasmix.o2.permille = (log[CMD_O2_PERCENT + g * 2] / 256
|
||||
+ log[CMD_O2_PERCENT + g * 2 + 1]) * 10;
|
||||
cyl.gasmix.he.permille = 0;
|
||||
add_cylinder(&dive->cylinders, g, std::move(cyl));
|
||||
dive->cylinders.add(g, std::move(cyl));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -732,7 +732,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
|
|||
cyl.gasmix.he.permille =
|
||||
(log[EMC_HE_PERCENT + g * 2] / 256
|
||||
+ log[EMC_HE_PERCENT + g * 2 + 1]) * 10;
|
||||
add_cylinder(&dive->cylinders, g, std::move(cyl));
|
||||
dive->cylinders.add(g, std::move(cyl));
|
||||
}
|
||||
|
||||
tm.tm_year = log[EMC_YEAR];
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ weight_t get_weightsystem_weight(const std::string &name)
|
|||
return it != ws_info_table.end() ? it->weight : weight_t();
|
||||
}
|
||||
|
||||
void add_cylinder(struct cylinder_table *t, int idx, cylinder_t cyl)
|
||||
void cylinder_table::add(int idx, cylinder_t cyl)
|
||||
{
|
||||
t->insert(t->begin() + idx, std::move(cyl));
|
||||
insert(begin() + idx, std::move(cyl));
|
||||
}
|
||||
|
||||
bool weightsystem_t::operator==(const weightsystem_t &w2) const
|
||||
|
|
@ -406,7 +406,7 @@ void add_default_cylinder(struct dive *d)
|
|||
cyl.type.size.mliter = 11100;
|
||||
cyl.type.workingpressure.mbar = 207000;
|
||||
}
|
||||
add_cylinder(&d->cylinders, 0, cyl);
|
||||
d->cylinders.add(0, cyl);
|
||||
reset_cylinders(d, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ struct cylinder_t
|
|||
struct cylinder_table : public std::vector<cylinder_t> {
|
||||
cylinder_t &operator[](size_t i);
|
||||
const cylinder_t &operator[](size_t i) const;
|
||||
|
||||
void add(int idx, cylinder_t cyl);
|
||||
};
|
||||
|
||||
struct weightsystem_t
|
||||
|
|
@ -90,9 +92,6 @@ extern int first_hidden_cylinder(const struct dive *d);
|
|||
extern void dump_cylinders(struct dive *dive, bool verbose);
|
||||
#endif
|
||||
|
||||
/* Cylinder table functions */
|
||||
extern void add_cylinder(struct cylinder_table *, int idx, cylinder_t cyl);
|
||||
|
||||
struct ws_info {
|
||||
std::string name;
|
||||
weight_t weight;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
/* Just the main cylinder until we can handle the buddy cylinder porperly */
|
||||
for (i = 0; i < 1; i++) {
|
||||
cylinder_t cyl = default_cylinder(dive.get());
|
||||
add_cylinder(&dive->cylinders, i, cyl);
|
||||
dive->cylinders.add(i, cyl);
|
||||
}
|
||||
|
||||
// Model 0=Xen, 1,2=Xeo, 4=Lynx, other=Liquivision
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue