Index: /trunk/src/world_entities/cameraman.cc
===================================================================
--- /trunk/src/world_entities/cameraman.cc	(revision 10479)
+++ /trunk/src/world_entities/cameraman.cc	(revision 10480)
@@ -82,15 +82,14 @@
 
 
-
 void CameraMan::createCam(const TiXmlElement* root)
 {
-  //Camera* newCamera=new Camera(root);
   this->cameras.push_back(new Camera(root));
- // cameras[cameras.size()-1]->target->detach();
   cameras[cameras.size()-1]->setClipRegion(nearClip, farClip);
-
-}
-
-void CameraMan::setCam(int cameraNo)
+}
+
+
+
+
+void CameraMan::setCam(unsigned int cameraNo)
 {
   if (cameraNo<cameras.size())
@@ -106,7 +105,5 @@
   if(object != NULL)
   {
-    Camera* currentCam = dynamic_cast<Camera*>(object) ;
-
-    this->setCam(currentCam);
+    this->setCam(dynamic_cast<Camera*>(object));
     return;
   }
@@ -120,5 +117,7 @@
   {
     PRINTF(0)("trying to add a zero camera! uiuiui!\n");
-  }
+    return;
+  }
+  
   this->currentCam = camera;
 
@@ -141,4 +140,61 @@
 
 
+void CameraMan::changeCurrTarget(const std::string& className, const std::string& objectName)
+{
+  BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
+  if( object != NULL && object->isA(PNode::staticClassID()))
+  {
+    currentCam->lookAt(dynamic_cast<PNode*>(object));
+    State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(object));
+  }
+}
+
+void CameraMan::atachCurrTarget(PNode* target)
+{
+  currentCam->target->atach(target);
+  State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(target));
+
+}
+
+void CameraMan::atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity)
+{
+  BaseObject* object = ObjectListBase::getBaseObject(className, targetEntity);
+
+  if(object != NULL && object->isA(PNode::staticClassID()))
+  {
+   this->atachCurrTarget(dynamic_cast<PNode*>(object));
+   return;
+  }
+
+printf("ERROR CAMERAMANAGER: Couldn't set camera to: %s %s \n", className.c_str(),targetEntity.c_str() );
+}
+
+
+
+void CameraMan::detachCurrCamera()
+{
+  currentCam->target->detach();
+}
+
+
+
+void CameraMan::jumpCurrCam(float x, float y, float z)
+{
+  currentCam->target->jump(x, y, z);
+}
+
+void CameraMan::togglFade()
+{
+  if( this->fadeToBlack)
+    fadeToBlack->toggleFade();
+}
+
+void CameraMan::initFadeBlack()
+{
+  if( this->fadeToBlack)
+    fadeToBlack->initFadeBlack();
+}
+
+
 void CameraMan::moveCam(int x, int y, int z, int camNo)
 {
@@ -164,38 +220,6 @@
   {
     dynamic_cast<Camera*>(newCam)->lookAt(dynamic_cast<PNode*>(object));
-    this->setCam( dynamic_cast<Camera*>(newCam));
     State::setCamera( dynamic_cast<Camera*>(newCam),  dynamic_cast<CameraTarget*>(object));
   }
-}
-
-void CameraMan::changeCurrTarget(const std::string& className, const std::string& objectName)
-{
-  BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
-  if( object != NULL && object->isA(PNode::staticClassID()))
-  {
-    currentCam->lookAt(dynamic_cast<PNode*>(object));
-    State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(object));
-  }
-}
-
-void CameraMan::atachCurrTarget(PNode* target)
-{
-  currentCam->target->atach(target);
-  State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(target));
-
-}
-
-void CameraMan::atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity)
-{
-  BaseObject* object = ObjectListBase::getBaseObject(className, targetEntity);
-
-  if(object != NULL)
-  {
-   this->atachCurrTarget(dynamic_cast<PNode*>(object));
-   //State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(object));
-   return;
-  }
-
-printf("ERROR CAMERAMANAGER: Couldn't set camera to: %s %s \n", className.c_str(),targetEntity.c_str() );
 }
 
@@ -206,19 +230,15 @@
   BaseObject* targetCam = ObjectListBase::getBaseObject("Camera", cameraName);
 
-  if(object != NULL && targetCam != NULL)
-  {
-   dynamic_cast<Camera*>(targetCam)->target->atach(dynamic_cast<PNode*>(object));
-   State::setCamera(this->currentCam,  dynamic_cast<CameraTarget*>(object));
-   return;
-  }
-
-printf("ERROR CAMERAMANAGER: Couldn't set camera %s to: %s %s \n", cameraName.c_str(), className.c_str(),targetEntity.c_str() );
-}
-
-
-void CameraMan::detachCurrCamera()
-{
-  currentCam->target->detach();
-}
+  if( object != NULL && targetCam != NULL && object->isA(PNode::staticClassID()) )
+  {
+    dynamic_cast<Camera*>(targetCam)->target->atach(dynamic_cast<PNode*>(object));
+    State::setCamera(dynamic_cast<Camera*>(targetCam),  dynamic_cast<CameraTarget*>(object));
+    return;
+  }
+
+  printf("ERROR CAMERAMANAGER: Couldn't set camera %s to: %s %s \n", cameraName.c_str(), className.c_str(),targetEntity.c_str() );
+}
+
+
 
 void CameraMan::jumpCam(int x, int y, int z, int camNo)
@@ -234,28 +254,8 @@
   this->farClip=farCli;
 
-  for(int i = 0; i < this->cameras.size(); i++)
+  for(unsigned int i = 0; i < this->cameras.size(); i++)
     cameras[i]->setClipRegion(nearCli, farCli);
 }
 
-
-void CameraMan::jumpCurrCam(float x, float y, float z)
-{
-  currentCam->target->jump(x, y, z);
-}
-
-
-
-
-void CameraMan::togglFade()
-{
-  if( this->fadeToBlack)
-    fadeToBlack->toggleFade();
-}
-
-void CameraMan::initFadeBlack()
-{
-  if( this->fadeToBlack)
-    fadeToBlack->initFadeBlack();
-}
 
 
Index: /trunk/src/world_entities/cameraman.h
===================================================================
--- /trunk/src/world_entities/cameraman.h	(revision 10479)
+++ /trunk/src/world_entities/cameraman.h	(revision 10480)
@@ -22,30 +22,12 @@
     std::vector<Camera*> cameras;
     CameraMan(const TiXmlElement* root = NULL);
-    void setCam(int CameraNo);
+    void setCam(unsigned int CameraNo);
     void setCam(const std::string& camName);
     void setCam(Camera* camera);
 
+    /// LOADING
+    virtual void loadParams(const TiXmlElement* root);
     void createCameras(const TiXmlElement* camerasTag);
     void createCam(const TiXmlElement* root);
-    void moveCam(int x, int y, int z,  int camNo);
-    void moveCurrCam(int x, int y, int z);
-    void changeTarget(int camNo, const std::string& className,const std::string& objectName);
-    void changeTarget(const std::string& camName,const std::string& className, const std::string& objectName);
-    void changeCurrTarget(const std::string& className, const std::string& objectName);
-    void atachCurrTarget(PNode* target);
-    void atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity);
-    void atachCameraToWorldEntity(const std::string& cameraName, const std::string& className, const std::string& targetEntity);
-    void detachCurrCamera();
-    void jumpCam(int x, int y, int z, int camNo);
-    void jumpCurrCam(float x, float y, float z);
-    void changeSpeed(float speed);
-    void setClipRegion(float nearClip, float farClip);
-    void togglFade();
-    void initFadeBlack();
-
-    void cameraInfo();
-
-    /// LOADING
-    virtual void loadParams(const TiXmlElement* root);
 
     /// POLLING
@@ -55,5 +37,30 @@
     const Camera* getCurrentCam() const { return this->currentCam; }
     Camera* getCurrentCam() { return this->currentCam; }
+
+    
+    /// Current camera
+    void moveCurrCam(int x, int y, int z);
+    void changeCurrTarget(const std::string& className, const std::string& objectName);
+    void atachCurrTarget(PNode* target);
+    void atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity);
+    void detachCurrCamera();
+    void jumpCurrCam(float x, float y, float z);
+    void togglFade();
+    void initFadeBlack();
+    
+    /// Camera
+    void moveCam(int x, int y, int z,  int camNo);
+    void changeTarget(int camNo, const std::string& className,const std::string& objectName);
+    void changeTarget(const std::string& camName,const std::string& className, const std::string& objectName);
+    void atachCameraToWorldEntity(const std::string& cameraName, const std::string& className, const std::string& targetEntity);
+    void jumpCam(int x, int y, int z, int camNo);
+    
+    void changeSpeed(float speed);
+    void setClipRegion(float nearClip, float farClip);
+    void cameraInfo();
+    
+  private:
     bool cameraIsInVector(Camera* camera);
+    
 
 };
