IfActions: Tweaks

This commit is contained in:
spx 2013-11-06 16:02:05 +09:00
parent fa81ea4fe9
commit b492d40f61

View File

@ -55,9 +55,11 @@ void IfActions::ReadOptions(ConfigParser& parser, const WCHAR* section)
void IfActions::ReadConditionOptions(ConfigParser& parser, const WCHAR* section)
{
std::wstring condition = parser.ReadString(section, L"IfCondition", L"");
if (!condition.empty())
{
std::wstring tAction = parser.ReadString(section, L"IfTrueAction", L"", false);
std::wstring fAction = parser.ReadString(section, L"IfFalseAction", L"", false);
if (!condition.empty() && (!tAction.empty() || !fAction.empty()))
if (!tAction.empty() || !fAction.empty())
{
int i = 1;
do
@ -72,16 +74,23 @@ void IfActions::ReadConditionOptions(ConfigParser& parser, const WCHAR* section)
}
// Check for IfCondition2/IfTrueAction2/IfFalseAction2 ... etc.
std::wstring key = L"IfTrueAction" + std::to_wstring(++i);
tAction = parser.ReadString(section, key.c_str(), L"", false);
key = L"IfFalseAction" + std::to_wstring(i);
fAction = parser.ReadString(section, key.c_str(), L"", false);
const std::wstring num = std::to_wstring(++i);
key = L"IfCondition" + std::to_wstring(i);
std::wstring key = L"IfCondition" + num;
condition = parser.ReadString(section, key.c_str(), L"");
if (condition.empty()) break;
key = L"IfTrueAction" + num;
tAction = parser.ReadString(section, key.c_str(), L"", false);
key = L"IfFalseAction" + num;
fAction = parser.ReadString(section, key.c_str(), L"", false);
}
while (!tAction.empty() || !fAction.empty());
}
else
{
m_Conditions.clear();
}
while (!condition.empty() && (!tAction.empty() || !fAction.empty()));
}
else
{