From 4cecb4957ed75dfb2c714acbf10a57115d63435b Mon Sep 17 00:00:00 2001 From: spx Date: Thu, 6 Sep 2012 00:39:01 -0700 Subject: [PATCH] IfEqualAction: Now compares the values as 64bit integer. http://rainmeter.net/forum/viewtopic.php?p=76312#p76312 --- Library/Measure.cpp | 6 +++--- Library/Measure.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 477521f7..6319c62e 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -141,7 +141,7 @@ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section) m_IfBelowValue = parser.ReadFloat(section, L"IfBelowValue", 0.0); m_IfBelowAction = parser.ReadString(section, L"IfBelowAction", L"", false); - m_IfEqualValue = parser.ReadFloat(section, L"IfEqualValue", 0.0); + m_IfEqualValue = (int64_t)parser.ReadFloat(section, L"IfEqualValue", 0.0); m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false); m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0); @@ -497,7 +497,7 @@ bool CMeasure::Update() { if (!m_IfEqualAction.empty()) { - if ((int)m_Value == (int)m_IfEqualValue) + if ((int64_t)m_Value == m_IfEqualValue) { if (!m_IfEqualCommitted) { @@ -552,7 +552,7 @@ bool CMeasure::Update() m_Value = 0.0; // Set IfAction committed state to false if condition is not met with value = 0 - if ((int)m_IfEqualValue != 0) + if (m_IfEqualValue != 0) { m_IfEqualCommitted = false; } diff --git a/Library/Measure.h b/Library/Measure.h index 92c60be9..c42c4210 100644 --- a/Library/Measure.h +++ b/Library/Measure.h @@ -99,7 +99,7 @@ protected: UINT m_AveragePos; UINT m_AverageSize; - double m_IfEqualValue; // The limit for the IfEqual action + int64_t m_IfEqualValue; // The limit for the IfEqual action double m_IfAboveValue; // The limit for the IfAbove action double m_IfBelowValue; // The limit for the IfBelow action std::wstring m_IfEqualAction; // The IfEqual action