Index: code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc
===================================================================
--- code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc	(revision 10097)
+++ code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc	(revision 10100)
@@ -62,7 +62,6 @@
         RegisterObject(Mini4Dgame);
 
-        this->center_ = 0;
-        this->player_[0] = NULL;
-        this->player_[1] = NULL;
+        this->center_ = NULL;
+        //TODO: player Null setzen
     }
 
@@ -134,5 +133,4 @@
     }
 
----------------------------------------------------------------------------------------------------------------------------------
 
     /**
@@ -142,22 +140,12 @@
     void Mini4Dgame::spawnPlayersIfRequested()
     {
-        // Spawn a human player.
+        // first spawn human players to assign always the left bat to the player in singleplayer
         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(it->first);
-    }
-    
-    bool Tetris::playerLeft(PlayerInfo* player)
-    {
-        bool left = Gametype::playerLeft(player);
-        if(player && player->isHumanPlayer())
-        {
-            if(this->activeBrick_ != NULL)
-            {
-                this->player_->stopControl();
-            }
-            this->cleanup();
-        }
-        return left;
+        // now spawn bots
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            if (!it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
+                this->spawnPlayer(it->first);
     }
 
@@ -168,68 +156,13 @@
         The player to be spawned.
     */
-    void Tetris::spawnPlayer(PlayerInfo* player)
+    void Mini4Dgame::spawnPlayer(PlayerInfo* player)
     {
         assert(player);
 
-        if(this->player_ == NULL)
+        if(false)//this->player_ == NULL)
         {
-            this->player_ = player;
+            //this->player_ = player;
             this->players_[player].state_ = PlayerState::Alive;
         }
-    }
-
-
-
-    void Tetris::startBrick(void)
-    {
-        if(this->player_ == NULL)
-            return;
-
-        unsigned int cameraIndex = 0;
-        if(this->activeBrick_ != NULL)
-        {
-            // Get camera settings
-            cameraIndex = this->activeBrick_->getCurrentCameraIndex();
-            this->player_->stopControl();
-            // destroy old active brick
-            this->activeBrick_->destroy();
-        }
-
-        // Make the last brick to be created the active brick.
-        this->activeBrick_ = this->futureBrick_;
-        this->futureBrick_ = 0;
-
-        // set its position
-        this->player_->startControl(this->activeBrick_);
-        float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
-        float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize();
-        this->activeBrick_->setPosition(xPos, yPos, 0.0f);
-        this->activeBrick_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f);
-        this->activeBrick_->setCameraPosition(cameraIndex);
-
-        // create a new future brick
-        this->createBrick();
-
-        // check if the new brick is in a valid position, otherwise end the game
-        if (!this->isValidBrickPosition(this->activeBrick_))
-            this->end();
-    }
-
-    void Tetris::createBrick(void)             //TODO: random rotation offset between 0 and 3 (times 90°)
-    {
-        // create new futureBrick_
-        this->futureBrick_ = new TetrisBrick(this->center_->getContext());
-
-
-        // Apply the stone template to the stone.
-        this->futureBrick_->addTemplate(this->center_->getBrickTemplate());
-
-        // Attach the brick to the Centerpoint and set the position of the brick to be at the left side.
-        this->center_->attach(this->futureBrick_);
-        float xPos = (this->center_->getWidth()*1.6f + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
-        float yPos = (this->center_->getHeight()-5.1f)*this->center_->getStoneSize();
-        
-        this->futureBrick_->setPosition(xPos, yPos, 0.0f);
-        this->futureBrick_->setGame(this);
     }
 
@@ -241,75 +174,12 @@
         Returns a pointer to the player. If there is no player, NULL is returned.
     */
-    PlayerInfo* Tetris::getPlayer(void) const
+    //TODO: colors
+    PlayerInfo* Mini4Dgame::getPlayer(int color) const
     {
-        return this->player_;
+        return players[color];
+    	//for(int i=0;i<NUMBEROFPLAYERS;i++)
+        	//if(color == this->mini4DgamePlayers[i].color)
+        		//return this->mini4DgamePlayers[i].info;
     }
 
-    /*TetrisCenterpoint* Tetris::getCenterpoint(void) const
-    {
-        return this->center_;
-    }*/
-
-    /**
-    @brief Set the TetrisCenterpoint (the playing field).
-    @param center A pointer to the TetrisCenterpoint to be set.
-    */
-    void Tetris::setCenterpoint(TetrisCenterpoint* center)
-    {
-        this->center_ = center;
-    }
-
-    /**
-    @brief Check each row if it is full. Removes all full rows. Update
-    @brief Manages score.
-    */
-    void Tetris::findFullRows()
-    {
-        unsigned int correctPosition = 0;
-        unsigned int stonesPerRow = 0;
-        for (unsigned int row = 0; row < this->center_->getHeight(); row++)
-        {
-            stonesPerRow = 0;
-            for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
-            {
-                std::list<SmartPtr<TetrisStone> >::iterator it_temp = it++;
-                correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize());
-                if(correctPosition == row)
-                {
-                    stonesPerRow++;
-                    if(stonesPerRow == this->center_->getWidth())
-                    {
-                        clearRow(row);
-                        row--; //the row counter has to be decreased in order to detect multiple rows!
-                        this->playerScored(this->player_);// add points
-                        //increase the stone's speed
-                        this->center_->setStoneSpeed(this->center_->getStoneSpeed()+1.0f);
-                    }
-                }
-            }
-        }
-    }
-
-    void Tetris::clearRow(unsigned int row)
-    {// clear the full row
-        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
-        {
-            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
-            {
-                (*it)->destroy();
-                this->stones_.erase(it++);
-            }
-            else
-                ++it;
-        }
-      // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
-        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
-        {
-            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
-                (*it)->setPosition((*it)->getPosition()-Vector3(0,10,0));
-        }
-
-    }
-
-
 }
