diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-12-11 22:34:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-13 11:49:59 -0800 |
commit | 50b11024d685129e78c36313b892dbc0e55c654c (patch) | |
tree | 96d56180e18ae2e11a7e4f3a6d86944883738797 /commands/command_edit.cpp | |
parent | 2e328c7633c1de43af000fd6506385c651365a0d (diff) | |
download | subsurface-50b11024d685129e78c36313b892dbc0e55c654c.tar.gz |
core: keep tank infos in a dynamic table
The list of known tank types were kept in a fixed size table.
Instead, use a dynamic table with our horrendous table macros.
This is more flexible and sensible.
While doing this, clean up the TankInfoModel, which was leaking
memory.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_edit.cpp')
-rw-r--r-- | commands/command_edit.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 686b5b91d..49b1c7cce 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -1207,9 +1207,9 @@ EditCylinder::EditCylinder(int index, cylinder_t cylIn, EditCylinderType typeIn, // Try to untranslate the cylinder type QString description = cylIn.type.description; - for (int i = 0; i < MAX_TANK_INFO && tank_info[i].name; ++i) { - if (gettextFromC::tr(tank_info[i].name) == description) { - description = tank_info[i].name; + for (int i = 0; i < tank_info_table.nr; ++i) { + if (gettextFromC::tr(tank_info_table.infos[i].name) == description) { + description = tank_info_table.infos[i].name; break; } } |