- Timestamp:
- Dec 10, 2007, 3:55:33 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/core/ConfigValueContainer.cc
r450 r451 12 12 13 13 /** 14 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_ int_.14 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_int_. 15 15 @param classname The name of the class the variable belongs to 16 16 @param varname The name of the variable … … 32 32 // Try to convert the value-string to int 33 33 std::istringstream istream(valueString); 34 if (!(istream >> this->value_ int_))34 if (!(istream >> this->value_.value_int_)) 35 35 { 36 36 // The conversion failed - use the default value and restore the entry in the config-file 37 this->value_ int_ = defvalue;37 this->value_.value_int_ = defvalue; 38 38 (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_; 39 39 ConfigValueContainer::writeConfigFile(CONFIGFILEPATH); … … 42 42 43 43 /** 44 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_ double_.44 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_double_. 45 45 @param classname The name of the class the variable belongs to 46 46 @param varname The name of the variable … … 62 62 // Try to convert the value-string to double 63 63 std::istringstream istream(valueString); 64 if (!(istream >> this->value_ double_))64 if (!(istream >> this->value_.value_double_)) 65 65 { 66 66 // The conversion failed - use the default value and restore the entry in the config-file 67 this->value_ double_ = defvalue;67 this->value_.value_double_ = defvalue; 68 68 (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_; 69 69 ConfigValueContainer::writeConfigFile(CONFIGFILEPATH); … … 72 72 73 73 /** 74 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_ bool_.74 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_bool_. 75 75 @param classname The name of the class the variable belongs to 76 76 @param varname The name of the variable … … 91 91 // Try to parse the value-string - is it a word? 92 92 if (valueString.find("true") < valueString.size() || valueString.find("yes") < valueString.size()) 93 this->value_ bool_ = true;93 this->value_.value_bool_ = true; 94 94 else if (valueString.find("false") < valueString.size() || valueString.find("no") < valueString.size()) 95 this->value_ bool_ = false;95 this->value_.value_bool_ = false; 96 96 else 97 97 { 98 98 // Its not a known word - is it a number? 99 99 std::istringstream istream(valueString); 100 if (!(istream >> this->value_ bool_))101 { 102 // The conversion failed - use the default value and restore the entry in the config-file 103 this->value_ bool_ = defvalue;100 if (!(istream >> this->value_.value_bool_)) 101 { 102 // The conversion failed - use the default value and restore the entry in the config-file 103 this->value_.value_bool_ = defvalue; 104 104 (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_; 105 105 ConfigValueContainer::writeConfigFile(CONFIGFILEPATH); … … 404 404 405 405 // Set the values of all types to zero 406 this->value_ int_ = 0;407 this->value_ double_ = 0.000000;408 this->value_ bool_ = false;406 this->value_.value_int_ = 0; 407 this->value_.value_double_ = 0.000000; 408 this->value_.value_bool_ = false; 409 409 this->value_string_ = ""; 410 410 this->value_vector2_ = Ogre::Vector2(0, 0);
Note: See TracChangeset
for help on using the changeset viewer.