Skip to content

Commit 9eedd95

Browse files
committed
Fix volatile variables not properly being updated in stringformatter
1 parent 659e839 commit 9eedd95

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

RasterPropMonitor/Core/RasterPropMonitorComputer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void RegisterResourceCallback(string variableName, Action<bool> cb)
178178
{
179179
var vc = InstantiateVariableOrNumber(variableName);
180180
vc.onResourceDepletedCallbacks += cb;
181-
cb(vc.numericValue < 0.01);
181+
cb(vc.AsDouble() < 0.01);
182182
}
183183

184184
/// <summary>

RasterPropMonitor/Core/StringProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public bool UpdateValues()
9999
{
100100
if (sourceVariable.isNumeric)
101101
{
102-
double newValue = sourceVariable.numericValue;
102+
double newValue = sourceVariable.AsDouble();
103103
if (JUtil.ValueChanged((double)sourceValues[i], newValue))
104104
{
105105
anyChanged = true;
@@ -108,7 +108,7 @@ public bool UpdateValues()
108108
}
109109
else
110110
{
111-
string newValue = sourceVariable.stringValue;
111+
string newValue = (string)sourceVariable.Get();
112112
anyChanged = anyChanged || newValue != (string)sourceValues[i];
113113
sourceValues[i] = newValue;
114114
}

RasterPropMonitor/Core/VariableOrNumber.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ enum VariableUpdateType
4141
public class VariableOrNumber
4242
{
4343
internal readonly string variableName;
44-
internal double numericValue;
45-
internal string stringValue;
44+
private double numericValue;
45+
private string stringValue;
4646
internal bool isNumeric;
4747
internal VariableUpdateType updateType;
4848
private readonly RasterPropMonitorComputer rpmComp;

0 commit comments

Comments
 (0)