]> git.tdb.fi Git - ext/subsurface.git/blobdiff - equipment.c
Fix up air use calculations for new pressure handling
[ext/subsurface.git] / equipment.c
index 64a05d5b024d3500ffbc6ff666cd3726d3ce99aa..62183c0c17054dc51ae461ee7488dd0991dbaaea 100644 (file)
@@ -71,12 +71,12 @@ static int convert_volume_pressure(int ml, int mbar, double *v, double *p)
        int decimals = 1;
        double volume, pressure;
 
+       volume = ml / 1000.0;
        if (mbar) {
                if (output_units.volume == CUFT) {
                        volume = ml_to_cuft(ml);
                        volume *= bar_to_atm(mbar / 1000.0);
-               } else
-                       volume = ml / 1000.0;
+               }
 
                if (output_units.pressure == PSI) {
                        pressure = mbar_to_PSI(mbar);
@@ -360,7 +360,7 @@ static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl
        }
 
        if (pressure && output_units.volume == CUFT) {
-               volume = cuft_to_ml(volume);
+               volume = cuft_to_l(volume);
                volume /= bar_to_atm(pressure);
        }
 
@@ -464,7 +464,7 @@ static void fill_tank_list(GtkListStore *store)
                /* Is it in cuft and psi? */
                if (psi) {
                        double bar = psi_to_bar(psi);
-                       double airvolume = cuft_to_ml(size);
+                       double airvolume = cuft_to_l(size) * 1000.0;
                        double atm = bar_to_atm(bar);
 
                        ml = airvolume / atm + 0.5;