core: convert cylinder_t and cylinder_table to C++

This had to be done simultaneously, because the table macros
do not work properly with C++ objects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-28 21:31:11 +02:00 committed by bstoeger
parent 284582d2e8
commit 28520da655
48 changed files with 593 additions and 710 deletions

View file

@ -602,7 +602,10 @@ void DiveGasPressureItem::replot(const dive *d, int fromIn, int toIn, bool in_pl
bool showDescriptions = false;
for (int cyl = 0; cyl < pInfo.nr_cylinders; cyl++) {
showDescriptions = showDescriptions || same_gasmix_cylinder(get_cylinder(d, cyl), cyl, d, true) != -1;
const cylinder_t *c = get_cylinder(d, cyl);
if (!c)
continue;
showDescriptions = showDescriptions || (c && same_gasmix_cylinder(*c, cyl, d, true) != -1);
if (act_segments[cyl].polygon.empty())
continue;
act_segments[cyl].cyl = cyl;
@ -655,7 +658,7 @@ void DiveGasPressureItem::plotGasValue(double mbar, double sec, const cylinder_t
QString gas = get_gas_string(cylinder->gasmix);
QString label;
if (showDescription)
label = QStringLiteral("(%1) %2").arg(cylinder->type.description, gas);
label = QStringLiteral("(%1) %2").arg(QString::fromStdString(cylinder->type.description), gas);
else
label = gas;
auto text = std::make_unique<DiveTextItem>(dpr, 1.0, align, this);