diff options
Diffstat (limited to 'equipment.c')
-rw-r--r-- | equipment.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/equipment.c b/equipment.c index cd3984c86..0c5939ff3 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 */ @@ -821,7 +831,7 @@ static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *we * we should pick up any other names from the dive * logs directly. */ -struct tank_info tank_info[100] = { +struct tank_info_t tank_info[100] = { /* Need an empty entry for the no-cylinder case */ { "", }, @@ -915,7 +925,7 @@ bad_tank_info: * We hardcode the most common weight system types * This is a bit odd as the weight system types don't usually encode weight */ -struct ws_info ws_info[100] = { +struct ws_info_t ws_info[100] = { { N_("integrated"), 0 }, { N_("belt"), 0 }, { N_("ankle"), 0 }, @@ -927,7 +937,7 @@ struct ws_info ws_info[100] = { static void fill_ws_list(GtkListStore *store) { GtkTreeIter iter; - struct ws_info *info = ws_info; + struct ws_info_t *info = ws_info; while (info->name) { gtk_list_store_append(store, &iter); |