[Orxonox-commit 7103] r11720 - in code/trunk/src: modules/gametypes orxonox/controllers orxonox/infos

landauf at orxonox.net landauf at orxonox.net
Sun Feb 4 16:58:38 CET 2018


Author: landauf
Date: 2018-02-04 16:58:37 +0100 (Sun, 04 Feb 2018)
New Revision: 11720

Modified:
   code/trunk/src/modules/gametypes/SpaceRace.cc
   code/trunk/src/modules/gametypes/SpaceRace.h
   code/trunk/src/modules/gametypes/SpaceRaceBot.cc
   code/trunk/src/modules/gametypes/SpaceRaceBot.h
   code/trunk/src/modules/gametypes/SpaceRaceController.cc
   code/trunk/src/orxonox/controllers/HumanController.h
   code/trunk/src/orxonox/infos/Bot.cc
   code/trunk/src/orxonox/infos/GametypeInfo.h
Log:
[SpaceRace_HS16] reverted some unwanted changes and fixed formatting a little bit

Modified: code/trunk/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.cc	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc	2018-02-04 15:58:37 UTC (rev 11720)
@@ -79,24 +79,17 @@
     {
         RegisterObject(SpaceRace);
 
-        this->botclass_ = Class(SpaceRaceBot); //ClassByString("")
+        this->botclass_ = Class(SpaceRaceBot);
         this->cantMove_ = false;
         this->bTimeIsUp_ = false;
-        this->setConfigValues();
 
         this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race 
         //we fixed the number of bots in order to have the same starting position all the time ! 
     }
 
-  void SpaceRace::setConfigValues()
-    {
-       
-    
-    }
-
     void SpaceRace::start()
     {
-    // define spawn positions of the 5 bots
+        // define spawn positions of the 5 bots
 
         int startpos[15];
         
@@ -119,44 +112,37 @@
         startpos[12] =0;
         startpos[13] =-40;
         startpos[14] =80;
-        
 
+        Gametype::start();
 
-
-        Gametype::start();
-   if (true)
+        this->spawnPlayersIfRequested();
+        this->cantMove_ = true;
+        //players are unable to move while countdown is running
+        for (Engine* engine : ObjectList<Engine>())
         {
-            this->spawnPlayersIfRequested();
-            this->cantMove_ = true;
-            //players are unable to move while countdown is running
-            for (Engine* engine : ObjectList<Engine>()){
-                engine->setActive(false);
-                
+            engine->setActive(false);
+        }
 
-            }
-           //append spawn positions to bots
-           int a,b,c;
-            a=0;
-            b=1;
-            c=2;
-              for (SpaceRaceBot* bot : ObjectList<SpaceRaceBot>()){
-                bot->getControllableEntity()->setPosition(startpos[a],startpos[b],startpos[c]);
-               a= a+3;
-               b = b+3; 
-               c+= 3;
-            }
+        //append spawn positions to bots
+        int a,b,c;
+        a=0;
+        b=1;
+        c=2;
 
-
+        for (SpaceRaceBot* bot : ObjectList<SpaceRaceBot>())
+        {
+            bot->getControllableEntity()->setPosition(startpos[a], startpos[b], startpos[c]);
+            a += 3;
+            b += 3;
+            c += 3;
         }
 
-                                                
-
         std::string message("Use headphones to hear the countdown!");
         this->getGametypeInfo()->sendAnnounceMessage(message);
         ChatManager::message(message);
 
-//after 11 seconds , countdownFinished function is called to activate bots` engines
-Timer* countdownTimer = new Timer();
+        //after 11 seconds , countdownFinished function is called to activate bots` engines
+        Timer* countdownTimer = new Timer();
         countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
     }
 
@@ -188,12 +174,6 @@
         this->Gametype::end();
     }
 
-
-void SpaceRace::tick(float dt)
-    {
-        SUPER(SpaceRace,tick,dt);
-}
-
     void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
     {
         this->checkpointReached_[player] = checkpoint;
@@ -206,12 +186,12 @@
     
         const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1) 
         + "after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.";
- this->getGametypeInfo()->sendAnnounceMessage(message);
+        this->getGametypeInfo()->sendAnnounceMessage(message);
         ChatManager::message(message);
 
     }
 
- void SpaceRace::countdownFinished()//activates the engines of all players 
+    void SpaceRace::countdownFinished()//activates the engines of all players
     {
 
         std::string message("RACE STARTED ");
@@ -219,14 +199,11 @@
         ChatManager::message(message);
 
 
-    for (Engine* engine : ObjectList<Engine>())
-                engine->setActive(true);
+        for (Engine* engine : ObjectList<Engine>())
+            engine->setActive(true);
+    }
 
-
-    
-}
-
- void SpaceRace::playerEntered(PlayerInfo* player)
+    void SpaceRace::playerEntered(PlayerInfo* player)
     {
         Gametype::playerEntered(player);
 
@@ -235,7 +212,7 @@
     }
 
 
- void SpaceRace::addBots(unsigned int amount) //function that add the bots to the game 
+    void SpaceRace::addBots(unsigned int amount) //function that add the bots to the game
     {
         for (unsigned int i = 1; i <= amount; ++i){
             this->botclass_.fabricate(this->getContext());
@@ -243,7 +220,7 @@
     }
 
 
-//set bot configurations
+    //set bot configurations
     bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
     {
         return true;
@@ -254,8 +231,7 @@
         return true;
     }
 
-    bool SpaceRace::allowPawnDeath(Pawn* victim, Pawn* originator)// false because the bots can not recognize the objects and die to early 
-                                                                    //if they can 
+    bool SpaceRace::allowPawnDeath(Pawn* victim, Pawn* originator)// false because the bots can not recognize the objects and die to earlyif they can
     {
         return false;
     }

Modified: code/trunk/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.h	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/modules/gametypes/SpaceRace.h	2018-02-04 15:58:37 UTC (rev 11720)
@@ -56,17 +56,14 @@
             SpaceRace(Context* context);
             virtual ~SpaceRace() {}
 
-             void setConfigValues();
-
-            virtual void tick(float dt) override;
             virtual void start() override;
             virtual void end() override;
- virtual void countdownFinished();
-             virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
+            virtual void countdownFinished();
+            virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
 
 
 
-             virtual void playerEntered(PlayerInfo* player) override;
+            virtual void playerEntered(PlayerInfo* player) override;
 
             //virtual void newCheckpointReached();
 

Modified: code/trunk/src/modules/gametypes/SpaceRaceBot.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceBot.cc	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/modules/gametypes/SpaceRaceBot.cc	2018-02-04 15:58:37 UTC (rev 11720)
@@ -22,19 +22,10 @@
  *  Created on: Oct 8, 2012
  *      Author: purgham
  */
-#include <vector>
 
 #include "SpaceRaceBot.h"
-#include "core/GameMode.h"
 #include "core/CoreIncludes.h"
-#include "core/config/ConfigValueIncludes.h"
-#include "gametypes/Gametype.h"
-#include "controllers/AIController.h"
-#include "gametypes/SpaceRaceController.h"
 
-
-
-
 namespace orxonox
 {
     RegisterClass(SpaceRaceBot);
@@ -41,26 +32,7 @@
 
     SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
         RegisterObject(SpaceRaceBot);
-        this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
+        this->defaultController_ = Class(SpaceRaceController);
         this->createController();
-
     }
-
-SpaceRaceBot::~SpaceRaceBot(){
-
 }
-
-void SpaceRaceBot::setConfigValues()
-    {
-        static const std::string names[] =
-        {
-            "Dr. Julius No",
-            "Berkay Berabi",
-            "Louis Meile"         
-            "Yo mama"
-        };
-        static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
-
-        SetConfigValue(names_, defaultnames);
-    }
-}

Modified: code/trunk/src/modules/gametypes/SpaceRaceBot.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceBot.h	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/modules/gametypes/SpaceRaceBot.h	2018-02-04 15:58:37 UTC (rev 11720)
@@ -29,7 +29,6 @@
 #include "infos/Bot.h"
 #include "gametypes/GametypesPrereqs.h"
 #include "gametypes/SpaceRaceController.h"
-#include <vector>
 
 
 namespace orxonox
@@ -39,24 +38,7 @@
     {
         public:
             SpaceRaceBot(Context* context);
-            virtual ~SpaceRaceBot();
-    
-            void setConfigValues();
-
-
-
- virtual inline bool isInitialized() const override
-                { return true; }
-            virtual inline float getPing() const override
-                { return 0; }
-            virtual inline float getPacketLossRatio() const override
-                { return 0; }
-
-
-  private:
-            std::vector<std::string> names_;
-
-
+            virtual ~SpaceRaceBot() {}
     };
 }
 

Modified: code/trunk/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceController.cc	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/modules/gametypes/SpaceRaceController.cc	2018-02-04 15:58:37 UTC (rev 11720)
@@ -15,7 +15,7 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have     a copy of the GNU General Public License
+ *   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.
  *
@@ -326,7 +326,7 @@
         //orxout(user_status) << "dt= " << dt << ";  distance= " << (lastPositionSpaceship-this->getControllableEntity()->getPosition()).length() <<std::endl;
         lastPositionSpaceship = this->getControllableEntity()->getPosition();
        
-this->boostControl();
+        this->boostControl();
         this->moveToPosition(nextRaceCheckpoint_->getPosition());
         this->boostControl();
     }

Modified: code/trunk/src/orxonox/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.h	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/orxonox/controllers/HumanController.h	2018-02-04 15:58:37 UTC (rev 11720)
@@ -91,9 +91,9 @@
             static Pawn* getLocalControllerEntityAsPawn();
             //friend class, for mouselook
             friend class Map;
-            static HumanController* localController_s;
 
         protected:
+            static HumanController* localController_s;
             bool controlPaused_;
 
     }; // tolua_export

Modified: code/trunk/src/orxonox/infos/Bot.cc
===================================================================
--- code/trunk/src/orxonox/infos/Bot.cc	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/orxonox/infos/Bot.cc	2018-02-04 15:58:37 UTC (rev 11720)
@@ -67,12 +67,35 @@
     {
         static const std::string names[] =
         {
+            "Dr. Julius No",
+            "Rosa Klebb",
+            "Auric Goldfinger",
+            "Emilio Largo",
+            "Ernst Stavro Blofeld",
+            "Dr. Kananga",
+            "Francisco Scaramanga",
+            "Karl Stromberg",
+            "Sir Hugo Drax",
+            "Aris Kristatos",
+            "Kamal Khan",
+            "General Orlov",
+            "Max Zorin",
+            "Brad Whitaker",
+            "General Georgi Koskov",
+            "Franz Sanchez",
+            "Alec Trevelyan",
+            "Elliot Carver",
+            "Elektra King",
+            "Viktor Zokas",
+            "Gustav Graves",
+            "Le Chiffre",
+            "Mr. White",
+            "Dominic Greene",
             "Berkay Berabi",
-            "Louis  Meile"
+            "Louis  Meile",
             "Muten Roshi",
             "Abradolf Lincler",
             "Lionel Messi",
-            "Kamal Khan",
             "Karl the Llama",
             "Thomas the Tankengine",
             "Rick",

Modified: code/trunk/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.h	2018-01-20 19:59:05 UTC (rev 11719)
+++ code/trunk/src/orxonox/infos/GametypeInfo.h	2018-02-04 15:58:37 UTC (rev 11720)
@@ -82,7 +82,6 @@
             */
             inline bool isStartCountdownRunning() const
                 { return this->bStartCountdownRunning_; }
-            
             void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
 
             /**
@@ -132,12 +131,11 @@
             void dispatchDeathMessage(const std::string& message) const;
             void dispatchStaticMessage(const std::string& message,const ColourValue& colour) const;
             void dispatchFadingMessage(const std::string& message) const;
-            void setStartCountdown(float countdown); // Set the start countdown to the input value.
 
-
         protected:
             void start(void); // Inform the GametypeInfo that the game has started.
             void end(void); // Inform the GametypeInfo that the game has ended.
+            void setStartCountdown(float countdown); // Set the start countdown to the input value.
             void countdownStartCountdown(float countDown); // Count down the start countdown by the specified value.
             void countDown(); // Count down the start countdown counter.
             void startStartCountdown(void); // Inform the GametypeInfo about the start of the start countdown.



More information about the Orxonox-commit mailing list