Index: branches/std/src/world_entities/skybox.cc
===================================================================
--- branches/std/src/world_entities/skybox.cc	(revision 7202)
+++ branches/std/src/world_entities/skybox.cc	(revision 7208)
@@ -38,8 +38,8 @@
  * @param fileName the file to take as input for the SkyBox
 */
-SkyBox::SkyBox(const char* fileName)
+SkyBox::SkyBox(const std::string& fileName)
 {
   this->preInit();
-  if (fileName)
+  if (!fileName.empty())
     this->setTextureAndType(fileName, ".jpg");
   this->postInit();
@@ -89,5 +89,5 @@
   this->setParentMode(PNODE_MOVEMENT);
 
-  this->textureName = NULL;
+  this->textureName = "";
 }
 
@@ -106,10 +106,17 @@
   for (int i = 0; i < 6; i++)
   {
-    if( this->material[i])
+    if (this->material[i])
       delete this->material[i];
-    if( this->cubeTexture[i])
+    if (this->cubeTexture[i])
       ResourceManager::getInstance()->unload(this->cubeTexture[i]);
   }
 }
+
+void SkyBox::setTexture(const std::string& name)
+{
+  this->textureName = name;
+  this->setTextureAndType (name, "jpg");
+};
+
 
 /**
@@ -122,29 +129,14 @@
                "skybox_right.jpg", "skybox_front.jpg", "skybox_back.jpg");
 */
-void SkyBox::setTextureAndType(const char* name, const char* extension)
-{
-  char* top    = new char[strlen(name)+strlen(extension)+ 10];
-  char* bottom = new char[strlen(name)+strlen(extension)+ 10];
-  char* left   = new char[strlen(name)+strlen(extension)+ 10];
-  char* right  = new char[strlen(name)+strlen(extension)+ 10];
-  char* front  = new char[strlen(name)+strlen(extension)+ 10];
-  char* back   = new char[strlen(name)+strlen(extension)+ 10];
-
-  sprintf(top, "%s_top.%s", name, extension);
-  sprintf(bottom, "%s_bottom.%s", name, extension);
-  sprintf(left, "%s_left.%s", name, extension);
-  sprintf(right, "%s_right.%s", name, extension);
-  sprintf(front, "%s_front.%s", name, extension);
-  sprintf(back, "%s_back.%s", name, extension);
+void SkyBox::setTextureAndType(const std::string& name, const std::string& extension)
+{
+  std::string top = name + "_top." + extension;
+  std::string bottom = name + "_bottom." + extension;
+  std::string left = name + "_left." + extension;
+  std::string right = name + "_right." + extension;
+  std::string front = name + "_front." + extension;
+  std::string back = name + "_back." + extension;
 
   this->setTextures(top, bottom, left, right, front, back);
-
-  // deleted alocated memory of this function
-  delete []top;
-  delete []bottom;
-  delete []left;
-  delete []right;
-  delete []front;
-  delete []back;
 }
 
@@ -158,6 +150,6 @@
  * @param back the back texture.
 */
-void SkyBox::setTextures(const char* top, const char* bottom, const char* left,
-                          const char* right, const char* front, const char* back)
+void SkyBox::setTextures(const std::string& top, const std::string& bottom, const std::string& left,
+                          const std::string& right, const std::string& front, const std::string& back)
 {
   this->material[0]->setDiffuseMap(top);
@@ -171,6 +163,6 @@
 }
 
-void SkyBox::loadCubeMapTextures(const char* top, const char* bottom, const char* left,
-                                  const char* right, const char* front, const char* back)
+void SkyBox::loadCubeMapTextures(const std::string& top, const std::string& bottom, const std::string& left,
+                                  const std::string& right, const std::string& front, const std::string& back)
 {
   this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(top, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
@@ -304,13 +296,13 @@
 
   SYNCHELP_READ_FLOAT( size, NWT_SB_SIZE );
-  if ( textureName )
+  if ( !this->textureName.empty() )
   {
-    delete[] textureName;
-    textureName = NULL;
+    textureName = "";
   }
-  SYNCHELP_READ_STRINGM( textureName, NWT_SB_TEXTURENAME );
+  char* texName;
+  SYNCHELP_READ_STRINGM( texName, NWT_SB_TEXTURENAME );
 
   this->setSize( size );
-  this->setTextureAndType( textureName, "jpg" );
+  this->setTextureAndType( texName, "jpg" );
   this->rebuild();
 
@@ -338,5 +330,5 @@
 
     SYNCHELP_WRITE_FLOAT(this->size, NWT_SB_SIZE);
-    SYNCHELP_WRITE_STRING(this->textureName, NWT_SB_TEXTURENAME);
+    SYNCHELP_WRITE_STRING(this->textureName.c_str(), NWT_SB_TEXTURENAME);
 
     return SYNCHELP_WRITE_N;
