Changeset 5642 in orxonox.OLD for trunk/src/lib/util/multi_type.cc
- Timestamp:
- Nov 19, 2005, 12:16:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/multi_type.cc
r5641 r5642 96 96 * @returns a Copy of itself. (strings inside are copied as well) 97 97 */ 98 MultiType MultiType::operator= (const MultiType& mt) 99 { 100 this->type = mt.type; 101 this->value = mt.value; 102 103 if (mt.type == MT_STRING && mt.storedString != NULL) 104 { 105 this->storedString = new char[strlen (mt.storedString)+1]; 106 strcpy(this->storedString, mt.storedString); 107 this->value.String = this->storedString; 108 } 109 else 110 this->storedString = NULL; 111 } 98 // MultiType MultiType::operator= (const MultiType& mt) 99 // { 100 // this->type = mt.type; 101 // this->value = mt.value; 102 // 103 // if (mt.type == MT_STRING && mt.storedString != NULL) 104 // { 105 // this->storedString = new char[strlen (mt.storedString)+1]; 106 // strcpy(this->storedString, mt.storedString); 107 // this->value.String = this->storedString; 108 // } 109 // else 110 // this->storedString = NULL; 111 // return *this; 112 // } 112 113 113 114 /** … … 126 127 this->type = (MT_Type)type; 127 128 129 if (this->type != type) 130 { 131 if (this->type == MT_NULL) 132 this->setString(""); 133 134 } 128 135 /// @todo check if this works... 129 136 … … 158 165 this->type = MT_FLOAT; 159 166 this->value.Float = value; 160 161 167 } 162 168 … … 308 314 { 309 315 sprintf(tmpString, "%d", this->value.Int); 310 this->storedString = new char[strlen 316 this->storedString = new char[strlen(tmpString)+1]; 311 317 strcpy (this->storedString, tmpString); 312 318 return this->storedString;
Note: See TracChangeset
for help on using the changeset viewer.