mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
MeasureScript: Additional fix for r663.
This commit is contained in:
parent
cb839b7ce8
commit
8c169e4d21
@ -13,6 +13,8 @@ CMeasureScript::CMeasureScript(CMeterWindow* meterWindow) : CMeasure(meterWindow
|
||||
{
|
||||
LuaManager::Init();
|
||||
|
||||
m_pLuaScript = NULL;
|
||||
|
||||
m_bUpdateDefined = false;
|
||||
m_bGetValueDefined = false;
|
||||
m_bGetStringValueDefined = false;
|
||||
@ -88,37 +90,8 @@ const WCHAR* CMeasureScript::GetStringValue(bool autoScale, double scale, int de
|
||||
|
||||
return CheckSubstitute(m_strValue.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
static WCHAR buffer[MAX_LINE_LENGTH];
|
||||
static WCHAR buffer2[MAX_LINE_LENGTH];
|
||||
double theValue = GetValue();
|
||||
|
||||
if(percentual)
|
||||
{
|
||||
swprintf(buffer, L"%i", (UINT)(100.0 * GetRelativeValue()));
|
||||
}
|
||||
else if(autoScale)
|
||||
{
|
||||
GetScaledValue(decimals, theValue, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(decimals == 0)
|
||||
{
|
||||
double val = theValue * (1.0 / scale);
|
||||
val = (val + ( (val >= 0) ? 0.5 : -0.5 ) );
|
||||
swprintf(buffer, L"%lli", (LONGLONG)val);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(buffer2, L"%%.%if", decimals);
|
||||
swprintf(buffer, buffer2, theValue * (1.0 / scale));
|
||||
}
|
||||
}
|
||||
|
||||
return CheckSubstitute(buffer);
|
||||
}
|
||||
return CMeasure::GetStringValue(autoScale, scale, decimals, percentual);
|
||||
}
|
||||
|
||||
static void stackDump (lua_State *L) {
|
||||
|
@ -60,7 +60,7 @@ LuaScript::LuaScript(lua_State* p_pState, const char* p_strFile, const char* p_s
|
||||
|
||||
LuaScript::~LuaScript(void)
|
||||
{
|
||||
delete[] m_strTableName;
|
||||
if (m_strTableName) free(m_strTableName);
|
||||
}
|
||||
|
||||
void LuaScript::BindVariable(const char* p_strName, void* p_pValue, const char* p_strTypeName)
|
||||
|
Loading…
x
Reference in New Issue
Block a user