Skip to content

Commit

Permalink
Extend minetest.is_yes()
Browse files Browse the repository at this point in the history
  • Loading branch information
red-001 authored and nerzhul committed Jan 7, 2017
1 parent b387f95 commit c435eab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/unittest/test_utilities.cpp
Expand Up @@ -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);
}


Expand Down
2 changes: 1 addition & 1 deletion src/util/string.h
Expand Up @@ -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;
}


Expand Down

0 comments on commit c435eab

Please sign in to comment.