Fixed to use per-propellant fuel flow mode override
Fixed to use per-propellant fuel flow mode override

--- a/Documents/CHANGES.txt
+++ b/Documents/CHANGES.txt
@@ -1,13 +1,3 @@
-1.0.17.0
-    Changed: Mach on the Build Engineer now accurate to 2 decimal places.
-    Changed: Max mach in the Build Engineer defaults to 1.00 even when no jet engines are present.
-    Changed: Increased eccentricity readout to 5 decimal places.  
-    Changed: Implemented Sarbian's object pooling. 
-    Fixed: Physically insignificant part mass is now associated with the parent part.
-    Fixed: Longitude and Latitude readouts now use a KER formatter instead of Squad's incorrect implementation.
-    Fixed: Possible null reference in the Rendezvous Processor.
-
-
 1.0.16.6, 02-05-15
     Fixed: Separately staged fairing mass jettisons are now calculated in the editor.
 

--- a/KerbalEngineer/Extensions/DoubleExtensions.cs
+++ b/KerbalEngineer/Extensions/DoubleExtensions.cs
@@ -1,7 +1,7 @@
 // 
 //     Kerbal Engineer Redux
 // 
-//     Copyright (C) 2015 CYBUTEK
+//     Copyright (C) 2014 CYBUTEK
 // 
 //     This program is free software: you can redistribute it and/or modify
 //     it under the terms of the GNU General Public License as published by
@@ -17,12 +17,18 @@
 //     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 // 
 
+#region Using Directives
+
+using KerbalEngineer.Helpers;
+
+#endregion
+
 namespace KerbalEngineer.Extensions
 {
-    using Helpers;
-
     public static class DoubleExtensions
     {
+        #region Methods: public
+
         public static double Clamp(this double value, double lower, double higher)
         {
             return value < lower ? lower : value > higher ? higher : value;
@@ -43,14 +49,14 @@
             return Units.ToDistance(value);
         }
 
+        public static string ToTorque(this double value)
+        {
+            return Units.ToTorque(value);
+        }
+
         public static string ToForce(this double value)
         {
             return Units.ToForce(value);
-        }
-
-        public static string ToMach(this double value)
-        {
-            return Units.ToMach(value);
         }
 
         public static string ToMass(this double value)
@@ -73,9 +79,6 @@
             return Units.ToSpeed(value);
         }
 
-        public static string ToTorque(this double value)
-        {
-            return Units.ToTorque(value);
-        }
+        #endregion
     }
 }

--- a/KerbalEngineer/Extensions/FloatExtensions.cs
+++ b/KerbalEngineer/Extensions/FloatExtensions.cs
@@ -1,7 +1,7 @@
 // 
 //     Kerbal Engineer Redux
 // 
-//     Copyright (C) 2015 CYBUTEK
+//     Copyright (C) 2014 CYBUTEK
 // 
 //     This program is free software: you can redistribute it and/or modify
 //     it under the terms of the GNU General Public License as published by
@@ -17,12 +17,18 @@
 //     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 // 
 
+#region Using Directives
+
+using KerbalEngineer.Helpers;
+
+#endregion
+
 namespace KerbalEngineer.Extensions
 {
-    using Helpers;
-
     public static class FloatExtensions
     {
+        #region Methods: public
+
         public static string ToAcceleration(this float value)
         {
             return Units.ToAcceleration(value);
@@ -43,9 +49,9 @@
             return Units.ToForce(value);
         }
 
-        public static string ToMach(this float value)
+        public static string ToTorque(this float value)
         {
-            return Units.ToMach(value);
+            return Units.ToTorque(value);
         }
 
         public static string ToMass(this float value)
@@ -68,9 +74,6 @@
             return Units.ToSpeed(value);
         }
 
-        public static string ToTorque(this float value)
-        {
-            return Units.ToTorque(value);
-        }
+        #endregion
     }
 }

--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -1,7 +1,7 @@
 // 
 //     Kerbal Engineer Redux
 // 
-//     Copyright (C) 2015 CYBUTEK
+//     Copyright (C) 2014 CYBUTEK
 // 
 //     This program is free software: you can redistribute it and/or modify
 //     it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
 
 namespace KerbalEngineer.Flight.Readouts
 {
+    #region Using Directives
+
     using System;
     using System.Collections.Generic;
     using System.Linq;
@@ -38,9 +40,17 @@
     using TimeToApoapsis = Orbital.TimeToApoapsis;
     using TimeToPeriapsis = Orbital.TimeToPeriapsis;
 
+    #endregion
+
     public static class ReadoutLibrary
     {
+        #region Fields
+
         private static List<ReadoutModule> readouts = new List<ReadoutModule>();
+
+        #endregion
+
+        #region Constructors
 
         /// <summary>
         ///     Sets up and populates the readout library with the stock readouts.
@@ -99,7 +109,6 @@
                 readouts.Add(new VerticalAcceleration());
                 readouts.Add(new HorizontalSpeed());
                 readouts.Add(new HorizontalAcceleration());
-                readouts.Add(new MachNumber());
                 readouts.Add(new Latitude());
                 readouts.Add(new Longitude());
                 readouts.Add(new GeeForce());
@@ -162,7 +171,7 @@
                 readouts.Add(new Rendezvous.OrbitalPeriod());
                 readouts.Add(new Rendezvous.SemiMajorAxis());
                 readouts.Add(new Rendezvous.SemiMinorAxis());
-
+                
                 // Misc
                 readouts.Add(new Separator());
                 readouts.Add(new GuiSizeAdjustor());
@@ -179,20 +188,22 @@
             }
         }
 
+        #endregion
+
+        #region Properties
+
         /// <summary>
         ///     Gets and sets the available readout modules.
         /// </summary>
         public static List<ReadoutModule> Readouts
         {
-            get
-            {
-                return readouts;
-            }
-            set
-            {
-                readouts = value;
-            }
-        }
+            get { return readouts; }
+            set { readouts = value; }
+        }
+
+        #endregion
+
+        #region Methods
 
         /// <summary>
         ///     Gets a list of readout modules which are associated with the specified category.
@@ -215,7 +226,7 @@
         /// </summary>
         public static void Reset()
         {
-            foreach (ReadoutModule readout in readouts)
+            foreach (var readout in readouts)
             {
                 readout.Reset();
             }
@@ -228,8 +239,8 @@
         {
             try
             {
-                SettingHandler handler = SettingHandler.Load("HelpStrings.xml");
-                foreach (ReadoutModule readout in readouts)
+                var handler = SettingHandler.Load("HelpStrings.xml");
+                foreach (var readout in readouts)
                 {
                     readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString);
                 }
@@ -240,5 +251,7 @@
                 Logger.Exception(ex);
             }
         }
+
+        #endregion
     }
 }

--- a/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs
+++ /dev/null
@@ -1,43 +1,1 @@
-// 
-//     Kerbal Engineer Redux
-// 
-//     Copyright (C) 2015 CYBUTEK
-// 
-//     This program is free software: you can redistribute it and/or modify
-//     it under the terms of the GNU General Public License as published by
-//     the Free Software Foundation, either version 3 of the License, or
-//     (at your option) any later version.
-// 
-//     This program is distributed in the hope that it will be useful,
-//     but WITHOUT ANY WARRANTY; without even the implied warranty of
-//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//     GNU General Public License for more details.
-// 
-//     You should have received a copy of the GNU General Public License
-//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
 
-namespace KerbalEngineer.Flight.Readouts.Surface
-{
-    using Extensions;
-    using Sections;
-
-    public class MachNumber : ReadoutModule
-    {
-        public MachNumber()
-        {
-            Name = "Mach Number";
-            Category = ReadoutCategory.GetCategory("Surface");
-            HelpString = "Shows the vessel's mach number.";
-            IsDefault = true;
-        }
-
-        public override void Draw(SectionModule section)
-        {
-            if (FlightGlobals.ActiveVessel.atmDensity > 0.0)
-            {
-                DrawLine(FlightGlobals.ActiveVessel.mach.ToMach(), section.IsHud);
-            }
-        }
-    }
-}

--- a/KerbalEngineer/Helpers/Units.cs
+++ b/KerbalEngineer/Helpers/Units.cs
@@ -1,7 +1,7 @@
 // 
 //     Kerbal Engineer Redux
 // 
-//     Copyright (C) 2015 CYBUTEK
+//     Copyright (C) 2014 CYBUTEK
 // 
 //     This program is free software: you can redistribute it and/or modify
 //     it under the terms of the GNU General Public License as published by
@@ -19,10 +19,14 @@
 
 namespace KerbalEngineer.Helpers
 {
+    #region Using Directives
     using System;
+
+    #endregion
 
     public static class Units
     {
+        #region Methods
         public const double GRAVITY = 9.80665;
 
         public static string Concat(int value1, int value2)
@@ -91,7 +95,7 @@
             int min = (int)Math.Floor(rem * 60);
             rem -= ((double)min / 60);
             int sec = (int)Math.Floor(rem * 3600);
-            return String.Format("{0:0}° {1:00}' {2:00}\"", deg, min, sec);
+            return String.Format("{0:0}° {1:00}' {2:00}\"", deg, min, sec); 
         }
 
         public static string ToDistance(double value, int decimals = 1)
@@ -133,11 +137,6 @@
             string format1 = (value1 < 100000.0) ? (value1 < 10000.0) ? (value1 < 100.0) ? (Math.Abs(value1) < Double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
             string format2 = (value2 < 100000.0) ? (value2 < 10000.0) ? (value2 < 100.0) ? (Math.Abs(value2) < Double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0";
             return value1.ToString(format1) + " / " + value2.ToString(format2) + "kN";
-        }
-
-        public static string ToMach(double value)
-        {
-            return value.ToString("0.00") + "Ma";
         }
 
         public static string ToMass(double value, int decimals = 0)
@@ -192,5 +191,6 @@
         {
             return value.ToString((value < 100.0) ? (Math.Abs(value) < Double.Epsilon) ? "N0" : "N1" : "N0") + "kNm";
         }
+        #endregion
     }
 }

--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -89,7 +89,6 @@
     <Compile Include="Flight\Readouts\Surface\Biome.cs" />
     <Compile Include="Flight\Readouts\Surface\HorizontalAcceleration.cs" />
     <Compile Include="Flight\Readouts\Surface\VerticalAcceleration.cs" />
-    <Compile Include="Flight\Readouts\Surface\MachNumber.cs" />
     <Compile Include="Flight\Readouts\Vessel\AttitudeProcessor.cs" />
     <Compile Include="Flight\Readouts\Vessel\DeltaVCurrentTotal.cs" />
     <Compile Include="Flight\Readouts\Vessel\PitchRate.cs" />

--- a/KerbalEngineer/VesselSimulator/EngineSim.cs
+++ b/KerbalEngineer/VesselSimulator/EngineSim.cs
@@ -31,6 +31,7 @@
         private static readonly Pool<EngineSim> pool = new Pool<EngineSim>(Create, Reset);
 
         private readonly ResourceContainer resourceConsumptions = new ResourceContainer();
+        private readonly ResourceContainer resourceFlowModes = new ResourceContainer();
 
         public double actualThrust = 0;
         public bool isActive = false;
@@ -52,6 +53,7 @@
         private static void Reset(EngineSim engineSim)
         {
             engineSim.resourceConsumptions.Reset();
+            engineSim.resourceFlowModes.Reset();
             engineSim.actualThrust = 0;
             engineSim.isActive = false;
             engineSim.isp = 0;
@@ -98,6 +100,7 @@
             engineSim.isActive = active;
             engineSim.thrustVec = vecThrust;
             engineSim.resourceConsumptions.Reset();
+            engineSim.resourceFlowModes.Reset();
             engineSim.appliedForces.Clear();
 
             double flowRate = 0.0;
@@ -164,6 +167,7 @@
                         theEngine.partId,
                         consumptionRate);
                 engineSim.resourceConsumptions.Add(propellant.id, consumptionRate);
+                engineSim.resourceFlowModes.Add(propellant.id, (double)propellant.GetFlowMode());
             }
 
             double thrustPerThrustTransform = engineSim.thrust / thrustTransforms.Count;
@@ -269,7 +273,7 @@
                     sourcePartSets.Add(type, sourcePartSet);
                 }
 
-                switch (ResourceContainer.GetResourceFlowMode(type))
+                switch ((ResourceFlowMode)this.resourceFlowModes[type])
                 {
                     case ResourceFlowMode.NO_FLOW:
                         if (partSim.resources[type] > SimManager.RESOURCE_MIN && partSim.resourceFlowStates[type] != 0)

--- a/KerbalEngineer/VesselSimulator/Simulation.cs
+++ b/KerbalEngineer/VesselSimulator/Simulation.cs
@@ -139,6 +139,7 @@
                 log.buf.AppendLine("PrepareSimulation started");
                 dumpTree = true;
             }
+            this._timer.Reset();
             this._timer.Start();
 
             // Store the parameters in members for ease of access in other functions
@@ -299,6 +300,7 @@
                 MonoBehaviour.print("RunSimulation started");
             }
 
+            this._timer.Reset();
             this._timer.Start();
 
             LogMsg log = null;

 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ