summaryrefslogtreecommitdiffstats
path: root/equipment.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-10 11:42:26 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-10 11:42:26 -0700
commite91ac60f4985667f8599d30881698e14e15fffca (patch)
treeba65660dd71c75fb061b966eca98e54cfb0a7636 /equipment.c
parent923b4cd9b1932c13ef52567ea095740887345b38 (diff)
downloadsubsurface-e91ac60f4985667f8599d30881698e14e15fffca.tar.gz
Fill ws_info structure and use it when entering weight systems
The code to initialize the weight systems from the last datafile loaded had not been brought over from the Gtk version. We now correctly update the data structure when loading file (but not yet when editing values). Most likely the same needs to be done for the tanks as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'equipment.c')
-rw-r--r--equipment.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/equipment.c b/equipment.c
index cd3984c86..b9001a85c 100644
--- a/equipment.c
+++ b/equipment.c
@@ -473,11 +473,21 @@ void add_cylinder_description(cylinder_type_t *type)
void add_weightsystem_description(weightsystem_t *weightsystem)
{
const char *desc;
+ int i;
desc = weightsystem->description;
if (!desc)
return;
- /* now do something with it... */
+ for (i = 0; i < 100 && ws_info[i].name != NULL; i++) {
+ if (strcmp(ws_info[i].name, desc) == 0) {
+ ws_info[i].grams = weightsystem->weight.grams;
+ return;
+ }
+ }
+ if (i < 100) {
+ ws_info[i].name = desc;
+ ws_info[i].grams = weightsystem->weight.grams;
+ }
}
#endif /* USE_GTK_UI */