1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-21 23:28:48 -05:00

Extend minetest.is_yes()

This commit is contained in:
red-001 2016-12-03 11:38:07 +00:00 committed by Ner'zhul
parent b387f95ed3
commit c435eabf3f
2 changed files with 3 additions and 1 deletions

View File

@ -147,6 +147,8 @@ void TestUtilities::testIsYes()
UASSERT(is_yes("0") == false);
UASSERT(is_yes("1") == true);
UASSERT(is_yes("2") == true);
UASSERT(is_yes("on") == true);
UASSERT(is_yes("off") == false);
}

View File

@ -272,7 +272,7 @@ inline bool is_yes(const std::string &str)
{
std::string s2 = lowercase(trim(str));
return s2 == "y" || s2 == "yes" || s2 == "true" || atoi(s2.c_str()) != 0;
return s2 == "y" || s2 == "yes" || s2 == "true" || s2 == "on" || atoi(s2.c_str()) != 0;
}