Index: trunk/src/util/multiplayer_team_deathmatch.cc
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9494)
+++ trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9656)
@@ -138,8 +138,7 @@
   if ( currentGameState == GAMESTATE_PRE_GAME || currentGameState == GAMESTATE_GAME )
   {
-    if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )
-         && box == NULL
-         &&  (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM
-         || bShowTeamChange )
+    if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) &&
+         box == NULL &&
+         (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM || bShowTeamChange )
 
        )
@@ -193,8 +192,14 @@
   }
 
-  if ( box != NULL
-       && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )
-       && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM
-       && !bShowTeamChange
+//   if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) )
+//   {
+//     PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM);
+//   }
+
+  // check if the menu should be removed and the game state should be entered
+  if ( box != NULL &&
+       PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) &&
+       PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM &&
+       !bShowTeamChange
      )
   {
@@ -310,4 +315,5 @@
   assert( false );
 }
+
 
 std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassID classId )
@@ -442,4 +448,7 @@
 }
 
+/**
+ *  this handles team changes but only on the master server
+ */
 void MultiplayerTeamDeathmatch::handleTeamChanges( )
 {
@@ -458,5 +467,5 @@
       if ( stats.getPreferedTeamId() == TEAM_SPECTATOR || ( stats.getPreferedTeamId() >= 0 && stats.getPreferedTeamId() < numTeams ) )
       {
-        teamChange( stats.getUserId() );
+        teamChange( stats.getAssignedUserId() );
       }
     }
@@ -473,5 +482,5 @@
       {
         stats.setPreferedTeamId( getRandomTeam() );
-        teamChange( stats.getUserId() );
+        teamChange( stats.getAssignedUserId() );
       }
     }
@@ -479,4 +488,10 @@
 }
 
+
+
+/**
+ * changes the team
+ * @param userId the user changing team (userId)
+ */
 void MultiplayerTeamDeathmatch::teamChange( int userId )
 {
@@ -489,8 +504,8 @@
 
 
-  ClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() );
-  std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
-  std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
-  float       playableScale = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );
+  ClassID       playableClassId  = getPlayableClassId( userId, stats.getPreferedTeamId() );
+  std::string   playableModel    = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
+  std::string   playableTexture  = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
+  float         playableScale    = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );
 
   BaseObject * bo = Factory::fabricate( playableClassId );
@@ -507,8 +522,11 @@
   playable.setSynchronized( true );
 
-  stats.setTeamId( stats.getPreferedTeamId() );
   stats.setPlayableClassId( playableClassId );
   stats.setPlayableUniqueId( playable.getUniqueID() );
   stats.setModelFileName( playableModel );
+  stats.setTeamId( stats.getPreferedTeamId() );
+
+  playable.setTeam(stats.getPreferedTeamId());
+
 
   this->respawnPlayable( &playable, stats.getPreferedTeamId(), 0.0f );
@@ -516,9 +534,8 @@
   if ( oldPlayable )
   {
-    //if ( userId == SharedNetworkData::getInstance()->getHostID() )
-    //  State::getPlayer()->setPlayable( NULL );
     delete oldPlayable;
   }
 }
+
 
 void MultiplayerTeamDeathmatch::onButtonExit( )
@@ -558,9 +575,10 @@
 }
 
-  /**
-   * function that processes events from the handler
-   * @param event: the event
-   * @todo replace SDLK_o with something from KeyMapper
-   */
+
+/**
+ * function that processes events from the handler
+ * @param event: the event
+ * @todo replace SDLK_o with something from KeyMapper
+ */
 void MultiplayerTeamDeathmatch::process( const Event & event )
 {
@@ -573,10 +591,10 @@
     if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed )
     {
-      PRINTF(0)("hide stats\n");
+      PRINTF(5)("hide stats\n");
       this->hideStats();
     }
     else if ( !this->statsBox && event.bPressed )
     {
-      PRINTF(0)("show stats\n");
+      PRINTF(5)("show stats\n");
       this->showStats();
     }
@@ -740,7 +758,7 @@
   PlayerStats & killerStats = *PlayerStats::getStats( killerUserId );
 
-  if ( killerStats.getPlayable() != killer || victimStats.getPlayable() != victim )
-  {
-    PRINTF(0)("killerStats.getPlayable() != killer || victimStats.getPlayable() != victim\n");
+  if ( killerStats.getPlayable() == NULL || victimStats.getPlayable() == NULL)
+  {
+    PRINTF(0)("killerStats.getPlayable() != NULL || victimStats.getPlayable() != NULL\n");
     PRINTF(0)("%x %x %x %x\n", killerStats.getPlayable(), killer, victimStats.getPlayable(), victim );
     PRINTF(0)("%d %d %d %d\n", killerStats.getPlayable()->getUniqueID(), killer->getUniqueID(), victimStats.getPlayable()->getUniqueID(), victim->getUniqueID() );
@@ -796,4 +814,10 @@
 
 
+/**
+ * respawns a playable in the world via spawning points
+ * @param playable the playable to respawn
+ * @param teamId the teamId to use
+ * @param delay time delay for delayed spawning
+ */
 void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay )
 {
Index: trunk/src/util/object_manager.cc
===================================================================
--- trunk/src/util/object_manager.cc	(revision 9494)
+++ trunk/src/util/object_manager.cc	(revision 9656)
@@ -134,5 +134,5 @@
   if (omList != OM_INIT || omList == OM_SIZE)
   {
-    PRINT(0)(" +ObjectManager-LIST: '%s'==size='%d'==---\n", ObjectManager::OMListToString((OM_LIST)omList), this->objectLists[omList].size());
+    PRINT(0)(" +ObjectManager-LIST: '%s'==size='%d'==---\n", ObjectManager::OMListToString((OM_LIST)omList).c_str(), this->objectLists[omList].size());
   //  if (level >= 1)
     {
@@ -174,8 +174,8 @@
  * @returns the String transformed from omList.
  */
-const char* ObjectManager::OMListToString(OM_LIST omList)
+const std::string& ObjectManager::OMListToString(OM_LIST omList)
 {
   if (omList == OM_INIT || omList == OM_SIZE)
-    return "===invalid===";
+    return ObjectManager::objectManagerListNames[OM_NULL];
 
   printf("%d\n", omList);
@@ -199,10 +199,10 @@
     }
   }
-  return OM_DEFAULT_LIST;
-}
-
-
-
-const char* ObjectManager::objectManagerListNames[] = {
+  return OM_NULL;
+}
+
+
+
+const std::string ObjectManager::objectManagerListNames[] = {
     "null",
     "dead",
Index: trunk/src/util/object_manager.h
===================================================================
--- trunk/src/util/object_manager.h	(revision 9494)
+++ trunk/src/util/object_manager.h	(revision 9656)
@@ -96,5 +96,5 @@
 
   static OM_LIST StringToOMList(const std::string& listName);
-  static const char* OMListToString(OM_LIST omList);
+  static const std::string& OMListToString(OM_LIST omList);
 
 
@@ -113,5 +113,5 @@
   EntityList                              objectLists[OM_SIZE];     //!< The ObjectLists.
 
-  static const char*                      objectManagerListNames[]; //!< Names of all the lists
+  static const std::string                objectManagerListNames[]; //!< Names of all the lists
 
   EntityList                              reflectionList;           //!< A list of all reflected objects in the world
