Changeset 7221 in orxonox.OLD for trunk/src/story_entities/story_entity.cc
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/story_entity.cc
r7193 r7221 40 40 this->isRunning = false; 41 41 42 this->loadFile = NULL;42 this->loadFile = ""; 43 43 this->storyID = -1; 44 this->description = NULL;45 this->menuItemImage = NULL;46 this->menuScreenshoot = NULL;44 this->description = ""; 45 this->menuItemImage = ""; 46 this->menuScreenshoot = ""; 47 47 this->nextStoryID = WORLD_ID_GAMEEND; 48 48 this->bMenuEntry = false; … … 100 100 * @param name the name of the path 101 101 */ 102 void StoryEntity::setLoadFile(const char*fileName)102 void StoryEntity::setLoadFile(const std::string& fileName) 103 103 { 104 if (this->loadFile)105 delete this->loadFile;106 104 if (ResourceManager::isFile(fileName)) 107 105 { 108 this->loadFile = new char[strlen(fileName)+1]; 109 strcpy(this->loadFile, fileName); 106 this->loadFile = fileName; 110 107 } 111 108 else … … 120 117 * @param name name 121 118 */ 122 void StoryEntity::setDescription(const char*description)119 void StoryEntity::setDescription(const std::string& description) 123 120 { 124 if (this->description) 125 delete[] this->description; 126 if (description!= NULL) 127 { 128 this->description= new char[strlen(description)+1]; 129 strcpy(this->description, description); 130 } 131 else this->description= NULL; 121 this->description = description; 132 122 } 133 123 … … 149 139 { 150 140 PRINTF(3)("Grabbing the Worlds Settings\n", this->getLoadFile()); 151 if( getLoadFile() == NULL)152 return;141 if( getLoadFile().empty()) 142 return; 153 143 TiXmlDocument XMLDoc(this->getLoadFile()); 154 144 // load the xml world file for further loading 155 145 if( !XMLDoc.LoadFile()) 156 146 { 157 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc.ErrorDesc(), this->getLoadFile() , XMLDoc.ErrorRow(), XMLDoc.ErrorCol());147 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc.ErrorDesc(), this->getLoadFile().c_str(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol()); 158 148 return; 159 149 } … … 181 171 * @param name name 182 172 */ 183 void StoryEntity::setMenuItemImage(const char*image)173 void StoryEntity::setMenuItemImage(const std::string& image) 184 174 { 185 if (this->menuItemImage) 186 delete[] this->menuItemImage; 187 if (image != NULL) 188 { 189 this->menuItemImage = new char[strlen(image)+1]; 190 strcpy(this->menuItemImage, image); 191 } 192 else this->menuItemImage = NULL; 175 this->menuItemImage = image; 193 176 } 194 177 195 178 196 /** sets the menu screenshoot of this StoryEntity @param name name */ 197 void StoryEntity::setMenuScreenshoot(const char* image) 179 /** sets the menu screenshoot of this StoryEntity 180 * @param name name 181 */ 182 void StoryEntity::setMenuScreenshoot(const std::string& image) 198 183 { 199 if (this->menuScreenshoot) 200 delete[] this->menuScreenshoot; 201 if (image != NULL) 202 { 203 this->menuScreenshoot = new char[strlen(image)+1]; 204 strcpy(this->menuScreenshoot, image); 205 } 206 else this->menuScreenshoot = NULL; 184 this->menuScreenshoot = image; 207 185 } 208 186
Note: See TracChangeset
for help on using the changeset viewer.