]> git.tdb.fi Git - ext/subsurface.git/blobdiff - parse-xml.c
Calculate OTUs for every dive
[ext/subsurface.git] / parse-xml.c
index 22ab8458e1f5871d932d4d5666c5df7ccc1a94dc..8f916b09aea3ed02b2d7ebb7c927263eb2bd7a83 100644 (file)
@@ -1051,7 +1051,7 @@ static void match_standard_cylinder(cylinder_type_t *type)
                return;
 
        cuft = type->size.mliter / 28317.0;
-       cuft *= type->workingpressure.mbar / 1013.25;
+       cuft *= to_ATM(type->workingpressure);
        psi = type->workingpressure.mbar / 68.95;
 
        switch (psi) {
@@ -1106,7 +1106,7 @@ static void sanitize_cylinder_type(cylinder_type_t *type)
 
        if (input_units.volume == CUFT || import_source == SUUNTO) {
                volume_of_air = type->size.mliter * 28.317;     /* milli-cu ft to milliliter */
-               atm = type->workingpressure.mbar / 1013.25;     /* working pressure in atm */
+               atm = to_ATM(type->workingpressure);            /* working pressure in atm */
                volume = volume_of_air / atm;                   /* milliliters at 1 atm: "true size" */
                type->size.mliter = volume + 0.5;
        }
@@ -1380,7 +1380,9 @@ void parse_xml_file(const char *filename, GError **error)
                }
                return;
        }
-
+       /* we assume that the last (or only) filename passed as argument is a 
+        * great filename to use as default when saving the dives */ 
+       set_filename(filename);
        reset_all();
        dive_start();
        traverse(xmlDocGetRootElement(doc));