Changeset 3894 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer/material.cc
- Timestamp:
- Apr 19, 2005, 6:48:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/material.cc
r3803 r3894 34 34 \param mtlName Name of the Material to be added to the Material List 35 35 */ 36 Material::Material (c har* mtlName)36 Material::Material (const char* mtlName) 37 37 { 38 38 PRINTF(4)("initializing new Material.\n"); 39 39 this->nextMat = NULL; 40 this->name = "";40 this->name = NULL; 41 41 this->setIllum(3); 42 42 this->setDiffuse(0,0,0); … … 55 55 this->specularTextureSet = false; 56 56 57 if (mtlName) 58 this->setName (mtlName); 59 else 60 this->setName(""); 57 this->setName(mtlName); 61 58 } 62 59 … … 80 77 \param mtlName The name of the Material to be added. 81 78 */ 82 Material* Material::addMaterial(c har* mtlName)79 Material* Material::addMaterial(const char* mtlName) 83 80 { 84 81 PRINTF(4)("adding Material %s.\n", mtlName); … … 98 95 \returns Material named mtlName if it is found. NULL otherwise. 99 96 */ 100 Material* Material::search(c har* mtlName)97 Material* Material::search(const char* mtlName) 101 98 { 102 99 PRINTF(5)("Searching for material %s", mtlName); … … 168 165 \param mtlName the Name of the Material to be set. 169 166 */ 170 void Material::setName (char* mtlName) 171 { 172 PRINTF(4)("setting Material Name to %s.\n", this->name); 173 this->name = new char [strlen(mtlName)+1]; 174 strcpy(this->name, mtlName); 167 void Material::setName (const char* mtlName) 168 { 169 if (this->name) 170 delete this->name; 171 if (mtlName) 172 { 173 this->name = new char [strlen(mtlName)+1]; 174 strcpy(this->name, mtlName); 175 } 176 else 177 { 178 this->name = new char[2]; 179 strcpy(this->name, ""); 180 } 175 181 } 176 182
Note: See TracChangeset
for help on using the changeset viewer.