Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/story_entities/story_entity.cc


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/story_entity.cc

    r7193 r7221  
    4040  this->isRunning = false;
    4141
    42   this->loadFile = NULL;
     42  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;
     
    100100 * @param name the name of the path
    101101 */
    102 void StoryEntity::setLoadFile(const char* fileName)
     102void StoryEntity::setLoadFile(const std::string& fileName)
    103103{
    104   if (this->loadFile)
    105     delete this->loadFile;
    106104  if (ResourceManager::isFile(fileName))
    107105  {
    108     this->loadFile = new char[strlen(fileName)+1];
    109     strcpy(this->loadFile, fileName);
     106    this->loadFile =  fileName;
    110107  }
    111108  else
     
    120117 * @param name name
    121118 */
    122 void StoryEntity::setDescription(const char* description)
     119void StoryEntity::setDescription(const std::string& description)
    123120{
    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;
    132122}
    133123
     
    149139{
    150140  PRINTF(3)("Grabbing the Worlds Settings\n", this->getLoadFile());
    151   if( getLoadFile() == NULL)
    152     return;
     141  if( getLoadFile().empty())
     142        return;
    153143  TiXmlDocument XMLDoc(this->getLoadFile());
    154144  // load the xml world file for further loading
    155145  if( !XMLDoc.LoadFile())
    156146  {
    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());
    158148    return;
    159149  }
     
    181171 * @param name name
    182172 */
    183 void StoryEntity::setMenuItemImage(const char* image)
     173void StoryEntity::setMenuItemImage(const std::string& image)
    184174{
    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;
    193176}
    194177
    195178
    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 */
     182void StoryEntity::setMenuScreenshoot(const std::string& image)
    198183{
    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;
    207185}
    208186
Note: See TracChangeset for help on using the changeset viewer.