Index: /branches/spaceshipcontrol/src/Makefile.am
===================================================================
--- /branches/spaceshipcontrol/src/Makefile.am	(revision 5879)
+++ /branches/spaceshipcontrol/src/Makefile.am	(revision 5880)
@@ -77,4 +77,5 @@
                   world_entities/power_ups/turret_power_up.cc \
                   world_entities/power_ups/laser_power_up.cc \
+                  world_entities/space_ships/space_ship.cc \
                   subprojects/benchmark.cc
 
Index: /branches/spaceshipcontrol/src/defs/class_id.h
===================================================================
--- /branches/spaceshipcontrol/src/defs/class_id.h	(revision 5879)
+++ /branches/spaceshipcontrol/src/defs/class_id.h	(revision 5880)
@@ -144,4 +144,5 @@
   CL_TERRAIN                    =    0x00000207,
   CL_TEST_ENTITY                =    0x00000209,
+  CL_SPACE_SHIP                 =    0x0000020a,
 
   CL_TURRET_POWER_UP            =    0x00000211,
Index: /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc	(revision 5879)
+++ /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc	(revision 5880)
@@ -28,4 +28,6 @@
 #include "weapons/cannon.h"
 
+#include "factory.h"
+#include "key_mapper.h"
 
 using namespace std;
@@ -46,9 +48,4 @@
 SpaceShip::~SpaceShip ()
 {
-  /* do not delete the weapons, they are contained in the pnode tree
-  and will be deleted there.
-  this only frees the memory allocated to save the list.
-  */
-  delete this->weaponMan;
 }
 
@@ -92,11 +89,11 @@
   cannon->setName("BFG");
 
-  this->weaponMan->addWeapon(wpLeft, 1, 0);
-  this->weaponMan->addWeapon(wpRight,1 ,1);
-  this->weaponMan->addWeapon(cannon, 0, 6);
-
-  //this->weaponMan->addWeapon(turret, 3, 0);
-
-  this->weaponMan->changeWeaponConfig(1);
+  this->getWeaponManager()->addWeapon(wpLeft, 1, 0);
+  this->getWeaponManager()->addWeapon(wpRight,1 ,1);
+  this->getWeaponManager()->addWeapon(cannon, 0, 6);
+
+  //this->getWeaponManager()->addWeapon(turret, 3, 0);
+
+  this->getWeaponManager()->changeWeaponConfig(1);
 }
 
@@ -121,33 +118,32 @@
 //   button->setBindNode(this);
 
-  this->weaponMan = new WeaponManager(this);
-  this->weaponMan->setSlotCount(7);
-
-  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
-  this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-
-  this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0));
-  this->weaponMan->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-
-  this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, -.5));
-  this->weaponMan->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
-
-  this->weaponMan->setSlotPosition(3, Vector(-1.5, .5, .5));
-  this->weaponMan->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
-
-  this->weaponMan->setSlotPosition(4, Vector(-1.5, -.5, .5));
-  this->weaponMan->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
-
-  this->weaponMan->setSlotPosition(5, Vector(-1.5, -.5, -.5));
-  this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
+  this->getWeaponManager()->setSlotCount(7);
+
+  this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
+  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
+  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
+  this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
+  this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
+  this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
+  this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
 //
-   this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0));
-   this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+   this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
+   this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    //
-//   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
-//   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
+//   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
+//   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
 //
-//   this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
-//   this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
+//   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
+//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
 
 }
@@ -169,5 +165,5 @@
 void SpaceShip::addWeapon(Weapon* weapon)
 {
-  this->weaponMan->addWeapon(weapon);
+  this->getWeaponManager()->addWeapon(weapon);
 }
 
@@ -179,5 +175,5 @@
 void SpaceShip::removeWeapon(Weapon* weapon)
 {
-  this->weaponMan->removeWeapon(weapon);
+  this->getWeaponManager()->removeWeapon(weapon);
 }
 
@@ -230,5 +226,5 @@
   glPopMatrix();
 
-  this->weaponMan->draw();
+  this->getWeaponManager()->draw();
 
   //this->debug(0);
@@ -244,5 +240,5 @@
   this->move(time);
 
-  this->weaponMan->tick(time);
+  this->getWeaponManager()->tick(time);
   // weapon system manipulation
   this->weaponAction();
@@ -270,5 +266,5 @@
     accel -= direction;
 
-  if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
+  if( this->bLeft > -this->getRelCoor().z*2)
   {
     accel -=(orthDirection);
@@ -276,5 +272,5 @@
     rotVal -= .4;
   }
-  if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
+  if( this->bRight > this->getRelCoor().z*2)
   {
     accel += orthDirection;
@@ -314,5 +310,5 @@
   if( this->bFire)
     {
-      this->weaponMan->fire();
+      this->getWeaponManager()->fire();
     }
 }
@@ -334,7 +330,7 @@
       this->bFire = event.bPressed;
   else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
-    this->weaponMan->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
+    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
-    this->weaponMan->previousWeaponConfig();
+    this->getWeaponManager()->previousWeaponConfig();
 
   else if( event.type == SDLK_PAGEUP)
@@ -352,19 +348,19 @@
   if ((float)rand()/RAND_MAX < .1)
   {
-    //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET))
+    //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))
     {
       turret = new Turret();
-      this->weaponMan->addWeapon(turret, 2);
-      this->weaponMan->changeWeaponConfig(2);
+      this->getWeaponManager()->addWeapon(turret, 2);
+      this->getWeaponManager()->changeWeaponConfig(2);
     }
   }
   else
   {
-    //if (this->weaponMan->hasFreeSlot(3))
+    //if (this->getWeaponManager()->hasFreeSlot(3))
     {
       turret = new AimingTurret();
-      this->weaponMan->addWeapon(turret, 3);
-
-      this->weaponMan->changeWeaponConfig(3);
+      this->getWeaponManager()->addWeapon(turret, 3);
+
+      this->getWeaponManager()->changeWeaponConfig(3);
     }
   }
Index: /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h
===================================================================
--- /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h	(revision 5879)
+++ /branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h	(revision 5880)
@@ -4,6 +4,6 @@
  */
 
-#ifndef _PLAYER_H
-#define _PLAYER_H
+#ifndef _SPACE_SHIP_H
+#define _SPACE_SHIP_H
 
 #include "playable.h"
@@ -15,31 +15,31 @@
 class SpaceShip : public Playable
 {
-      
+
   public:
-         
+
     SpaceShip();
     SpaceShip(const char* fileName);
     SpaceShip(const TiXmlElement* root);
     virtual ~SpaceShip();
-          
+
     void init();
     void loadParams(const TiXmlElement* root);
-         
+
     void addWeapon(Weapon* weapon );
     void removeWeapon(Weapon* weapon);
-    
+
     virtual void postSpawn();
     virtual void leftWorld();
-    
+
     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     virtual void tick(float time);
     virtual void draw() const;
 
-    void process(const Event &event);
-    
-    
-         
+    virtual void process(const Event &event);
+
+
+
   private:
-          
+
     void move(float time);
     void weaponAction();
@@ -47,5 +47,5 @@
     // !! temporary !!
     void ADDWEAPON();
-    
+
     bool                  bUp;                //!< up button pressed.
     bool                  bDown;              //!< down button pressed.
@@ -62,3 +62,3 @@
 };
 
-#endif /* _PLAYABLE_H */
+#endif /* _SPACE_SHIPS_H */
