Index: branches/new_class_id/src/util/multiplayer_team_deathmatch.cc
===================================================================
--- branches/new_class_id/src/util/multiplayer_team_deathmatch.cc	(revision 9704)
+++ branches/new_class_id/src/util/multiplayer_team_deathmatch.cc	(revision 9705)
@@ -56,5 +56,5 @@
  */
 MultiplayerTeamDeathmatch::MultiplayerTeamDeathmatch(const TiXmlElement* root)
-  : NetworkGameRules(root)
+    : NetworkGameRules(root)
 {
   this->registerObject(this, MultiplayerTeamDeathmatch::_objectList);
@@ -111,11 +111,11 @@
 
   LoadParam(root, "death-penalty-timeout", this, MultiplayerTeamDeathmatch, setDeathPenaltyTimeout)
-      .describe("sets the time in seconds a player has to wait for respawn");
+  .describe("sets the time in seconds a player has to wait for respawn");
 
   LoadParam(root, "max-kills", this, MultiplayerTeamDeathmatch, setMaxKills)
-      .describe("sets the maximal kills for winning condition");
+  .describe("sets the maximal kills for winning condition");
 
   LoadParam(root, "num-teams", this, MultiplayerTeamDeathmatch, setNumTeams)
-      .describe("sets number of teams");
+  .describe("sets number of teams");
 
 }
@@ -189,8 +189,8 @@
   }
 
-//   if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) )
-//   {
-//     PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM);
-//   }
+  //   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
@@ -270,5 +270,4 @@
   if( unlikely( this->bLocalPlayerDead))
   {
-
   }
 }
@@ -305,8 +304,8 @@
 {
   if ( team == TEAM_NOTEAM || team == TEAM_SPECTATOR )
-    return CL_SPECTATOR;
+    return NewObjectListBase::retrieveIdentity("Spectator");
 
   if ( team == 0 || team == 1 )
-    return CL_TURBINE_HOVER;
+    return NewObjectListBase::retrieveIdentity("TurbineHover");
 
   assert( false );
@@ -314,8 +313,8 @@
 
 
-std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassID classId )
+std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, const NewClassID& classId )
 {
   if (classId == CL_TURBINE_HOVER)
-   return "models/ships/hoverglider_mainbody.obj";
+    return "models/ships/hoverglider_mainbody.obj";
   if ( team == 0 )
     return "models/creatures/doom_guy.md2";
@@ -326,5 +325,5 @@
 }
 
-std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
+std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, const NewClassID& classId )
 {
   if ( classId == CL_FPS_PLAYER )
@@ -339,7 +338,7 @@
 }
 
-float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, ClassID classId )
-{
-  if ( classId == CL_FPS_PLAYER )
+float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, const NewClassID& classId )
+{
+  if ( classId == NewObjectListBase::retrieveIdentity(CL_FPS_PLAYER))
   {
     return 10.0f;
@@ -359,13 +358,9 @@
     teamScore[i] = 0;
 
-
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-
-  if ( !list )
-    return;
-
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
+  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    PlayerStats & stats = *(*it);
 
     if ( stats.getTeamId() >= 0 )
@@ -387,12 +382,9 @@
     playersInTeam[i] = 0;
 
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-
-  if ( !list )
-    return 0;
-
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
+  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    PlayerStats & stats = *(*it);
 
     if ( stats.getTeamId() >= 0 )
@@ -450,13 +442,9 @@
 void MultiplayerTeamDeathmatch::handleTeamChanges( )
 {
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-
-  if ( !list )
-    return;
-
-  //first server players with choices
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
+  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    PlayerStats & stats = *(*it);
 
     if ( stats.getTeamId() != stats.getPreferedTeamId() )
@@ -470,7 +458,9 @@
 
   //now serve player who want join a random team
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
+  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    PlayerStats & stats = *(*it);
 
     if ( stats.getTeamId() != stats.getPreferedTeamId() )
@@ -501,5 +491,5 @@
 
 
-  ClassID       playableClassId  = getPlayableClassId( userId, stats.getPreferedTeamId() );
+  NewClassID       playableClassId  = getPlayableClassId( userId, stats.getPreferedTeamId() );
   std::string   playableModel    = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
   std::string   playableTexture  = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
@@ -584,5 +574,6 @@
     if ( event.bPressed )
       this->bShowTeamChange = true;
-  } else if ( event.type == SDLK_F1 )
+  }
+  else if ( event.type == SDLK_F1 )
   {
     if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed )
@@ -680,9 +671,9 @@
 void MultiplayerTeamDeathmatch::hideStats( )
 {
-    if ( statsBox )
-    {
-      delete statsBox;
-      statsBox = NULL;
-    }
+  if ( statsBox )
+  {
+    delete statsBox;
+    statsBox = NULL;
+  }
 }
 
@@ -819,13 +810,12 @@
 void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay )
 {
-  const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
-
-  assert( list );
 
   std::vector<SpawningPoint*> spList;
 
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it);
+  for (NewObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
+       it != SpawningPoint::objectList().end();
+       ++it)
+  {
+    SpawningPoint * sp = (*it);
 
     if ( sp->getTeamId() == teamId )
@@ -835,7 +825,9 @@
   if ( spList.size() == 0 )
   {
-    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-    {
-      SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it);
+    for (NewObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
+	 it != SpawningPoint::objectList().end();
+	 ++it)
+    {
+      SpawningPoint * sp = (*it);
 
       if ( sp->getTeamId() < 0 )
