Skip to content

Commit

Permalink
Merge pull request #647 from MOARdV/master
Browse files Browse the repository at this point in the history
v0.29.2
  • Loading branch information
MOARdV authored Oct 18, 2017
2 parents aa0bf1e + 5ed448b commit 17a183e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion GameData/JSI/RasterPropMonitor/RasterPropMonitor.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"VERSION": {
"MAJOR": 0,
"MINOR": 29,
"PATCH": 1
"PATCH": 2
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion RasterPropMonitor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ Global
$36.inheritsSet = Mono
$36.inheritsScope = text/plain
$36.scope = text/plain
version = 0.29.1
version = 0.29.2
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions RasterPropMonitor/Core/MathVariable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum Operator
ATAN2,
MAXINDEX,
MININDEX,
MODULO,
};

public readonly string name;
Expand Down Expand Up @@ -107,6 +108,12 @@ internal MathVariable(ConfigNode node, RasterPropMonitorComputer rpmComp)
indexOperator = false;
maxParameters = 2;
}
else if (oper == Operator.MODULO.ToString())
{
op = Operator.MODULO;
indexOperator = false;
maxParameters = 2;
}
else if (oper == Operator.MAXINDEX.ToString())
{
op = Operator.MAXINDEX;
Expand Down Expand Up @@ -207,6 +214,9 @@ public object Evaluate()
case Operator.ATAN2:
value = Math.Atan2(value, operand) * Mathf.Rad2Deg;
break;
case Operator.MODULO:
value = (operand == 0.0) ? 0.0 : (value - operand * Math.Floor(value / operand));
break;
}
}

Expand Down
5 changes: 3 additions & 2 deletions RasterPropMonitor/Core/MonitorPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ public void UpdateText(RasterPropMonitorComputer rpmComp)
{
if (isMutable)
{
if(spf == null)
if (spf == null)
{
string[] linesArray = text.Split(JUtil.LineSeparator, StringSplitOptions.None);
spf = new StringProcessorFormatter[linesArray.Length];
for(int i=0; i<linesArray.Length; ++i)
for (int i = 0; i < linesArray.Length; ++i)
{
spf[i] = new StringProcessorFormatter(linesArray[i], rpmComp);
}
Expand Down Expand Up @@ -388,6 +388,7 @@ public MonitorPage(int idNum, ConfigNode node, RasterPropMonitor thatMonitor)
{
if (node.HasValue("cameraTransform"))
{
JUtil.LogInfo(this, "WARNING: 'cameraTransform' in a PAGE node is deprecated, and the functionality will be removed in a future RPM release. Please use a JSISteerableCamera background handler instead.");
isMutable = true;
background = BackgroundType.Camera;
camera = node.GetValue("cameraTransform");
Expand Down
5 changes: 1 addition & 4 deletions RasterPropMonitor/Core/RPMVCPerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ internal enum DockingNodeState

//--- Power production
internal List<ModuleAlternator> availableAlternators = new List<ModuleAlternator>();
internal List<float> availableAlternatorOutput = new List<float>();
internal List<ModuleResourceConverter> availableFuelCells = new List<ModuleResourceConverter>();
internal List<float> availableFuelCellOutput = new List<float>();
internal List<ModuleGenerator> availableGenerators = new List<ModuleGenerator>();
Expand Down Expand Up @@ -136,7 +135,6 @@ internal void InvalidateModuleLists()
availableAblators.Clear();
availableAirIntakes.Clear();
availableAlternators.Clear();
availableAlternatorOutput.Clear();
availableDeployableWheels.Clear();
availableEngines.Clear();
availableFuelCells.Clear();
Expand Down Expand Up @@ -209,7 +207,6 @@ internal void UpdateModuleLists()
if (alt.resHandler.outputResources[i].name == "ElectricCharge")
{
availableAlternators.Add(alt);
availableAlternatorOutput.Add((float)alt.resHandler.outputResources[i].rate);
break;
}
}
Expand Down Expand Up @@ -415,7 +412,7 @@ private void FetchElectricData()
for (int i = 0; i < availableAlternators.Count; ++i)
{
// I assume there's only one ElectricCharge output in a given ModuleAlternator
alternatorOutput += availableAlternatorOutput[i] * availableAlternators[i].outputRate;
alternatorOutput += availableAlternators[i].outputRate;
}

for (int i = 0; i < availableSolarPanels.Count; ++i)
Expand Down
17 changes: 8 additions & 9 deletions RasterPropMonitor/Core/RasterPropMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,7 @@ public override void OnUpdate()
}
else
{
if (!resourceDepleted && !noCommConnection)
{
RenderScreen();
}
RenderScreen();
}
}
else
Expand All @@ -519,10 +516,8 @@ public override void OnUpdate()
FillScreenBuffer();
textRefreshRequired = false;
}
if (!resourceDepleted && !noCommConnection)
{
RenderScreen();
}
RenderScreen();

firstRenderComplete = true;
}

Expand Down Expand Up @@ -584,10 +579,14 @@ void ResourceDepletedCallback(bool newValue)
void CommConnectionCallback(float newValue)
{
//None, ProbeNone, Partial, ProbePartial
if ((newValue == 0.0) || (newValue == 2.0) || (newValue == 8.0) || (newValue == 10.0))
if ((newValue == 0.0f) || (newValue == 2.0f) || (newValue == 8.0f) || (newValue == 10.0f))
{
noCommConnection = true;
}
else
{
noCommConnection = false;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
// Revision number is altered automatically.
[assembly: AssemblyVersion("0.29.1.*")]
[assembly: AssemblyVersion("0.29.2.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down

0 comments on commit 17a183e

Please sign in to comment.