Index: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	(revision 12395)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	(revision 12396)
@@ -1,35 +1,2 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file OrxoBlox.cc
-    @brief Implementation of the OrxoBlox class.
-*/
-
 #include "OrxoBlox.h"
 #include "Highscore.h"
@@ -100,37 +67,24 @@
     void OrxoBlox::cleanup()
     {   
-        //if (this->ball_ != nullptr) // Destroy the ball, if present.
-        //{
-        //    this->ball_->destroy();
-        //    this->ball_ = nullptr;
-        //}
-
-        /*if (this->futureWall_ != nullptr)
-            {
-            this->futureWall_->destroy();
-            this->futureWall_ = nullptr;
-            }
-        */
-
+
+        std::vector<OrxoBloxWall*> vyserion_targets;
+        std::vector<OrxoBloxStones*> casterly_rocks;
+
+        for (OrxoBloxWall* wall : ObjectList<OrxoBloxWall>()) {
+            if(wall != nullptr) {
+                vyserion_targets.push_back(wall);
+            }
+        }
         for (OrxoBloxStones* stone : ObjectList<OrxoBloxStones>()) {
-            if(stone != nullptr)
-            stone->destroy();
-        }
-
-
-        for (OrxoBloxWall* wall : this->activeWalls_) {
-            if (wall != nullptr)
-                wall->destroy();
-        }
-        this->activeWalls_.clear();
-
-        this->stones_.clear();
-        if(this->playership != nullptr) {
-            this->playership->destroy();
-        }
-        if(this->center_ != nullptr) {
-            this->center_->destroy();
-        }
-        
+            if(stone != nullptr) {
+                casterly_rocks.push_back(stone);
+            }
+        }
+        for(unsigned int i = 0; i < vyserion_targets.size(); i++) {
+            vyserion_targets.at(i)->destroy();
+        }
+        for(unsigned int i = 0; i < casterly_rocks.size(); i++) {
+            casterly_rocks.at(i)->destroy();
+        }
 
     }
@@ -146,7 +100,5 @@
         if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place.
         {
-
             level_= 1;
-
         }
         else // If no centerpoint was specified, an error is thrown and the level is exited.
@@ -156,19 +108,8 @@
             return;
         }
-
-        // Start the timer. After it has expired the ball is started.
         this->starttimer_.startTimer();
 
-        // Set variable to temporarily force the player to spawn.
-        // Set variable to temporarily force the player to spawn.
-        //bool temp = this->bForceSpawn_;
         this->bForceSpawn_ = false;
-
-        // Call start for the parent class.
         Deathmatch::start();
-
-        // Reset the variable.
-        //this->bForceSpawn_ = temp;
-
     }
 
@@ -199,15 +140,4 @@
     }
    
-    // void OrxoBlox::spawnPlayer(PlayerInfo* player)
-    // {
-    //     assert(player);
-
-    //     if(this->player_ == nullptr)
-    //     {
-    //         this->player_ = player;
-    //         this->players_[player].state_ = PlayerState::Alive;
-    //     }
-
-    // }
 
     void OrxoBlox::LevelUp(){
@@ -219,31 +149,5 @@
 
         this->createWall();
-        this->activeWalls_.push_back(this->futureWall_);
-        for (int i = 0; i < this->futureWall_->getNumberOfStones(); i++) {
-            this->stones_.push_back(this->futureWall_->getStone(i));
-        }
-
-        for(OrxoBloxWall* wall : this->activeWalls_) {
-            if(wall == nullptr) {
-                continue;
-            }
-            if(wall->isEmpty()) {
-                wall->destroy();
-            }
-            int NumberOfStones = 0;
-            for(int i = 0; i < 10; i++) {
-                if(wall->getStone(i) == nullptr) {
-                    continue;
-                }
-                else {
-                    NumberOfStones++;
-                }
-
-            }
-        }
-        //new location of ship
-        //new amount of balls
-        //create balls
-        //insert new wall
+
         for(OrxoBloxStones* stone : ObjectList<OrxoBloxStones>()){
             if (stone->isA(Class(OrxoBloxStones))) {
@@ -257,12 +161,11 @@
                     orxout() << "calling end() function" << endl;
                     this->end();
+                    return;
                 }
             }
             else {
-                stone = nullptr;
-            }
-        }
-
-        
+                orxout() << "WTF IS THIS SHIT?!?!?!" << endl;
+            }
+        }
     }
 
@@ -280,37 +183,4 @@
 
 
-    /**
-    @brief
-        Starts the ball with some default speed.
-    */
-    //void OrxoBlox::startBall()
-    //{
-    //    if (this->ball_ != nullptr && this->center_ != nullptr)
-    //        this->ball_->setSpeed(this->center_->getBallSpeed());
-    //}
-     
-    /*OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
-        //orxout() << "Checking for Collision" << endl;
-        Vector3 BallPosition = Ball->getPosition();
-        for(OrxoBloxStones* someStone : this->stones_)
-        {
-            if(someStone == nullptr) 
-            {
-                continue;
-            }
-            //orxout() << "Checking a stone" << endl;
-            const Vector3& StonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
-            int size = someStone->getSize()/2;
-            if((BallPosition.x - Ball->getRadius() >= StonePosition.x - size && BallPosition.x + Ball->getRadius() <= StonePosition.x + size) && 
-                (BallPosition.z - Ball->getRadius() >= StonePosition.z - size && BallPosition.z + Ball->getRadius() <= StonePosition.z + size)) {
-                //orxout() << "FOUND ONE" << endl;
-                return someStone;
-            }
-        }
-        orxout() << "Found nothing...." << endl;
-        return nullptr;
-    }
-    */
-
     void OrxoBlox::playerPreSpawn(PlayerInfo* player)
     {
@@ -322,27 +192,5 @@
         SUPER(OrxoBlox, tick, dt);
     }
-/*
-    bool OrxoBlox::Intersect(int XpositionBall, int XPositionBlock, int YPositionBall, int YPositionBlock, int radiusBall, int sizeBlock) {
-        distanceX = XpositionBall - XPositionBlock;
-        distanceY = YPositionBall - YPositionBlock;
-        if (distanceX < 0) {
-            distanceX = -distanceX;
-        }
-        if (distanceY < 0) {
-            distanceY = -distanceY;
-        }
-        if((distanceX <= radiusBall + sizeBlock) || (distanceY <= radiusBall + sizeBlock)) {
-            return true;
-        }
-        else {
-            top = YPositionBall + radiusBall;
-            right = XpositionBall + radiusBall;
-            bottom = YPositionBall - radiusBall;
-            left = XpositionBall - radiusBall;
-
-            if((top >= YPositionBlock - size) && (top <= YPositionBlock + size) && (left <= XPositionBlock + size) && (left >= XPositionBlock - size))
-        }
-    }
-  */  
+ 
     void OrxoBlox::count() {
         if(++(this->counter) >= this->max_counter) {
