Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7214 in orxonox.OLD for branches/std/src/story_entities


Ignore:
Timestamp:
Mar 10, 2006, 7:18:03 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now the branche works again, as it did before

Location:
branches/std/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/story_entities/story_entity.cc

    r7203 r7214  
    4242  this->loadFile = "";
    4343  this->storyID = -1;
    44   this->description = NULL;
    45   this->menuItemImage = NULL;
    46   this->menuScreenshoot = NULL;
     44  this->description = "";
     45  this->menuItemImage = "";
     46  this->menuScreenshoot = "";
    4747  this->nextStoryID = WORLD_ID_GAMEEND;
    4848  this->bMenuEntry = false;
     
    117117 * @param name name
    118118 */
    119 void StoryEntity::setDescription(const char* description)
     119void StoryEntity::setDescription(const std::string& description)
    120120{
    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;
    129122}
    130123
     
    178171 * @param name name
    179172 */
    180 void StoryEntity::setMenuItemImage(const char* image)
     173void StoryEntity::setMenuItemImage(const std::string& image)
    181174{
    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;
    190176}
    191177
    192178
    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 */
     182void StoryEntity::setMenuScreenshoot(const std::string& image)
    195183{
    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;
    204185}
    205186
  • branches/std/src/story_entities/story_entity.h

    r7203 r7214  
    6868  /**  gets the story id of the current entity @returns story id */
    6969  inline int getNextStoryID() const { return this->nextStoryID; }
    70   inline void setDescription(const char* description);
     70  inline void setDescription(const std::string& description);
    7171  /** @returns the description of this StoryEntity */
    72   inline const char* getDescription() { return this->description; }
     72  inline const std::string& getDescription() { return this->description; }
    7373
    7474  void grabWorldInfo();
     
    7878  inline bool isContainedInMenu() { return this->bMenuEntry; }
    7979  /** 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);
    8181  /** @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);
    8484  /** @returns the menu screenshoot of this StoryEntity */
    85   inline const char* getMenuScreenshoot() { return this->menuScreenshoot; }
     85  inline const std::string& getMenuScreenshoot() { return this->menuScreenshoot; }
    8686
    8787  protected:
     
    9696    std::string   loadFile;         //!< The file from which this world is loaded
    9797
    98     char*         description;      //!< the description of the StoryEntity
    99     char*         menuItemImage;    //!< the item image of the StoryEntity
    100     char*         menuScreenshoot;  //!< the screenshoot of the StoryEntity
     98    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
    101101    bool          bMenuEntry;       //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
    102102};
Note: See TracChangeset for help on using the changeset viewer.