Changeset 7214 in orxonox.OLD for branches/std/src/story_entities
- Timestamp:
- Mar 10, 2006, 7:18:03 PM (19 years ago)
- Location:
- branches/std/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/story_entities/story_entity.cc
r7203 r7214 42 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; … … 117 117 * @param name name 118 118 */ 119 void StoryEntity::setDescription(const char*description)119 void StoryEntity::setDescription(const std::string& description) 120 120 { 121 if (this->description) 122 delete[] this->description; 123 if (description!= NULL) 124 { 125 this->description= new char[strlen(description)+1]; 126 strcpy(this->description, description); 127 } 128 else this->description= NULL; 121 this->description = description; 129 122 } 130 123 … … 178 171 * @param name name 179 172 */ 180 void StoryEntity::setMenuItemImage(const char*image)173 void StoryEntity::setMenuItemImage(const std::string& image) 181 174 { 182 if (this->menuItemImage) 183 delete[] this->menuItemImage; 184 if (image != NULL) 185 { 186 this->menuItemImage = new char[strlen(image)+1]; 187 strcpy(this->menuItemImage, image); 188 } 189 else this->menuItemImage = NULL; 175 this->menuItemImage = image; 190 176 } 191 177 192 178 193 /** sets the menu screenshoot of this StoryEntity @param name name */ 194 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) 195 183 { 196 if (this->menuScreenshoot) 197 delete[] this->menuScreenshoot; 198 if (image != NULL) 199 { 200 this->menuScreenshoot = new char[strlen(image)+1]; 201 strcpy(this->menuScreenshoot, image); 202 } 203 else this->menuScreenshoot = NULL; 184 this->menuScreenshoot = image; 204 185 } 205 186 -
branches/std/src/story_entities/story_entity.h
r7203 r7214 68 68 /** gets the story id of the current entity @returns story id */ 69 69 inline int getNextStoryID() const { return this->nextStoryID; } 70 inline void setDescription(const char*description);70 inline void setDescription(const std::string& description); 71 71 /** @returns the description of this StoryEntity */ 72 inline const char*getDescription() { return this->description; }72 inline const std::string& getDescription() { return this->description; } 73 73 74 74 void grabWorldInfo(); … … 78 78 inline bool isContainedInMenu() { return this->bMenuEntry; } 79 79 /** sets the menu item image of this StoryEntity @param name name */ 80 inline void setMenuItemImage(const char*image);80 inline void setMenuItemImage(const std::string& image); 81 81 /** @returns the menu item image of this StoryEntity */ 82 inline const char*getMenuItemImage() { return this->menuItemImage; }83 inline void setMenuScreenshoot(const char*image);82 inline const std::string& getMenuItemImage() { return this->menuItemImage; } 83 inline void setMenuScreenshoot(const std::string& image); 84 84 /** @returns the menu screenshoot of this StoryEntity */ 85 inline const char*getMenuScreenshoot() { return this->menuScreenshoot; }85 inline const std::string& getMenuScreenshoot() { return this->menuScreenshoot; } 86 86 87 87 protected: … … 96 96 std::string loadFile; //!< The file from which this world is loaded 97 97 98 char*description; //!< the description of the StoryEntity99 char*menuItemImage; //!< the item image of the StoryEntity100 char*menuScreenshoot; //!< the screenshoot of the StoryEntity98 std::string description; //!< the description of the StoryEntity 99 std::string menuItemImage; //!< the item image of the StoryEntity 100 std::string menuScreenshoot; //!< the screenshoot of the StoryEntity 101 101 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific 102 102 };
Note: See TracChangeset
for help on using the changeset viewer.