[Orxonox-commit 7667] r12260 - code/branches/OrxoBlox_FS19/src/modules/OrxoBlox

ahuwyler at orxonox.net ahuwyler at orxonox.net
Thu Mar 28 15:49:58 CET 2019


Author: ahuwyler
Date: 2019-03-28 15:49:58 +0100 (Thu, 28 Mar 2019)
New Revision: 12260

Modified:
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
Log:
Changed OrxoBlox.cc

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-03-28 14:47:15 UTC (rev 12259)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-03-28 14:49:58 UTC (rev 12260)
@@ -46,6 +46,7 @@
 #include "OrxoBloxBat.h"
 #include "OrxoBloxBot.h"
 #include "OrxoBloxAI.h"
+
 namespace orxonox
 {
     // Events to allow to react to scoring of a player, in the level-file.
@@ -65,7 +66,6 @@
         this->center_ = nullptr;
         this->ball_ = nullptr;
         this->bat_[0] = nullptr;
-        this->bat_[1] = nullptr;
 
         this->setHUDTemplate("OrxoBloxHUD");
 
@@ -156,15 +156,10 @@
             this->center_->attach(this->bat_[0]);
             this->center_->attach(this->bat_[1]);
             this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
-            this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
             this->bat_[0]->yaw(Degree(-90));
-            this->bat_[1]->yaw(Degree(90));
             this->bat_[0]->setSpeed(this->center_->getBatSpeed());
-            this->bat_[1]->setSpeed(this->center_->getBatSpeed());
             this->bat_[0]->setFieldHeight(this->center_->getFieldDimension().y);
-            this->bat_[1]->setFieldHeight(this->center_->getFieldDimension().y);
             this->bat_[0]->setLength(this->center_->getBatLength());
-            this->bat_[1]->setLength(this->center_->getBatLength());
 
             // Set the bats for the ball.
             this->ball_->setBats(this->bat_);
@@ -234,13 +229,6 @@
             player->startControl(this->bat_[0]);
             this->players_[player].state_ = PlayerState::Alive;
         }
-        // If the second (right) bat has no player.
-        else if (this->bat_[1]->getPlayer() == nullptr)
-        {
-            player->startControl(this->bat_[1]);
-            this->players_[player].state_ = PlayerState::Alive;
-        }
-        // If both bats are taken.
         else
             return;
 
@@ -263,9 +251,8 @@
         if (this->center_ != nullptr) // If there is a centerpoint.
         {
             // Fire an event for the player that has scored, to be able to react to it in the level, e.g. by displaying fireworks.
-            if (player == this->getRightPlayer())
-                this->center_->fireEvent(FireEventName(OrxoBloxCenterpoint, right));
-            else if (player == this->getLeftPlayer())
+            
+            if (player == this->getLeftPlayer())
                 this->center_->fireEvent(FireEventName(OrxoBloxCenterpoint, left));
 
             // Also announce, that the player has scored.
@@ -286,7 +273,7 @@
         if (this->bat_[0] != nullptr && this->bat_[1] != nullptr)
         {
             this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
-            this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
+            
         }
 
         // If a player gets enough points, he won the game -> end of game
@@ -293,8 +280,6 @@
         PlayerInfo* winningPlayer = nullptr;
         if (this->getLeftPlayer() && this->getScore(this->getLeftPlayer()) >= scoreLimit_)
             winningPlayer = this->getLeftPlayer();
-        else if (this->getRightPlayer() && this->getScore(this->getRightPlayer()) >= scoreLimit_)
-            winningPlayer = this->getRightPlayer();
 
         if (winningPlayer)
         {
@@ -336,11 +321,5 @@
     @return
         Returns a pointer to the player playing on the right. If there is no right player, nullptr is returned.
     */
-    PlayerInfo* OrxoBlox::getRightPlayer() const
-    {
-        if (this->bat_[1] != nullptr)
-            return this->bat_[1]->getPlayer();
-        else
-            return nullptr;
-    }
+    
 }

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-03-28 14:47:15 UTC (rev 12259)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-03-28 14:49:58 UTC (rev 12260)
@@ -93,7 +93,7 @@
 
             WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field.
             WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
-            WeakPtr<OrxoBloxBat> bat_[2]; //!< The two bats.
+            WeakPtr<OrxoBloxBat> bat_[1]; //!< The two bats.
             Timer starttimer_; //!< A timer to delay the start of the game.
             int scoreLimit_; //!< If a player scored that much points, the game is ended.
     };



More information about the Orxonox-commit mailing list