CHANGED: #1471 CInterfaceElement::convertBool is now implemented with NLMISC::fromString, and can convert both 0/1 and false/true style strings to boolean.

This commit is contained in:
dfighter1985 2012-08-15 16:01:50 +02:00
parent 5076c5ccdf
commit 40abb664c9

View file

@ -997,9 +997,11 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool CInterfaceElement::convertBool (const char *ptr) bool CInterfaceElement::convertBool (const char *ptr)
{ {
string str= ptr; std::string str = ptr;
NLMISC::strlwr(str); NLMISC::strlwr( str );
return str=="true"?true:false; bool b = false;
fromString( str, b );
return b;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------