mail[Wesnoth-commits] r13529 - /trunk/src/serialization/string_utils.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by DannyDaemonic on September 12, 2006 - 12:57:
Author: dirus
Date: Tue Sep 12 12:56:31 2006
New Revision: 13529

URL: http://svn.gna.org/viewcvs/wesnoth?rev=13529&view=rev
Log:
In string_bool, test for empty string first, not last.

Modified:
    trunk/src/serialization/string_utils.cpp

Modified: trunk/src/serialization/string_utils.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/string_utils.cpp?rev=13529&r1=13528&r2=13529&view=diff
==============================================================================
--- trunk/src/serialization/string_utils.cpp (original)
+++ trunk/src/serialization/string_utils.cpp Tue Sep 12 12:56:31 2006
@@ -283,11 +283,13 @@
 
 bool string_bool(const std::string& str,bool def)
 {
-       if(str == "yes" || str == "on" || str == "true" || 
lexical_cast_default<int>(str)) {
-               return true;
-       }
-       if(str == "no" || str == "off" || str == "false" || (str != "" && 
!lexical_cast_default<int>(str))) {
-               return false;
+       if(str != "") {
+               if(str == "yes" || str == "on" || str == "true" || 
lexical_cast_default<int>(str)) {
+                       return true;
+               }
+               if(str == "no" || str == "off" || str == "false" || 
!lexical_cast_default<int>(str)) {
+                       return false;
+               }
        }
        return def;
 }




Related Messages


Powered by MHonArc, Updated Tue Sep 12 13:00:11 2006