[Orxonox-commit 300] r2934 - in branches/gametypes/src/orxonox: gamestates objects/gametypes objects/worldentities/pawns

vmikos at orxonox.net vmikos at orxonox.net
Mon Apr 27 16:26:50 CEST 2009


Author: vmikos
Date: 2009-04-27 16:26:49 +0200 (Mon, 27 Apr 2009)
New Revision: 2934

Added:
   branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
Modified:
   branches/gametypes/src/orxonox/gamestates/GSLevel.cc
   branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt
   branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc
   branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h
   branches/gametypes/src/orxonox/objects/worldentities/pawns/CMakeLists.txt
   branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
Log:
fast endversion TeamBaseMatch

Modified: branches/gametypes/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/gametypes/src/orxonox/gamestates/GSLevel.cc	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/gamestates/GSLevel.cc	2009-04-27 14:26:49 UTC (rev 2934)
@@ -48,7 +48,7 @@
 
 namespace orxonox
 {
-    SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l");
+    SetCommandLineArgument(level, "teambasematchlevel.oxw").shortcut("l");
 
     GSLevel::GSLevel()
 //        : GameState<GSGraphics>(name)

Modified: branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt	2009-04-27 14:26:49 UTC (rev 2934)
@@ -2,6 +2,7 @@
   Gametype.cc
   Deathmatch.cc
   TeamDeathmatch.cc
+  TeamBaseMatch.cc
   Pong.cc
   UnderAttack.cc
 )

Modified: branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc	2009-04-27 14:26:49 UTC (rev 2934)
@@ -24,20 +24,22 @@
  
  
 
-#include TeamBaseMatch.h
+#include "TeamBaseMatch.h"
 
 
 //implement this! not done yet!
 #include "objects/worldentities/pawns/TeamBaseMatchBase.h" 
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
  
- 
 namespace orxonox
 {
     CreateUnloadableFactory(TeamBaseMatch);
 
 
     // Timer and Creator
-    TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathMatch(creator)
+    TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator)
     {
         RegisterObject(TeamBaseMatch);
 
@@ -52,13 +54,16 @@
     // set the Bases positions using XML
     void TeamBaseMatch::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
+        SUPER(TeamBaseMatch, XMLPort, xmlelement, mode);
+
 //        XMLPortObject(TeamBaseMatch, WorldEntity, setNeutralshape, getNeturalshape, xmlelement, mode); 
 //        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam1shape, getTeam1shape, xmlelement, mode);
 //        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam2shape, getTeam2shape, xmlelement, mode);
 
-        XMLPortObject(TeamBaseMatch, TeamBaseMatchBase, addBase, getBase, xmlelement, mode);
+//        XMLPortObject(TeamBaseMatch, TeamBaseMatchBase,  addBase, getBase, xmlelement, mode);
     }
     
+/*
     // pretty useless at the moment...should be implemented in the TeamBaseMatchBase class headerfile
     // State of the Base (controlled, uncontrolled)
     int TeamBaseMatch::baseState(Base)
@@ -67,14 +72,17 @@
         if(Enum state_==controlTeam1) return 1;
         if(Enum state_==controlTeam2) return 2;
     }
-    
+*/  
+
+
+    // Change the control of the defeated base and respawn it with its initial health
     bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator)
     {
-        set::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(victim);
-        if (it != this->bases_.end() && victim)
+        TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
+        if (base)
         {
-            TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
-            if (base)
+            std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(base);
+            if (it != this->bases_.end())
             {
                 int teamnr = this->getTeam(originator->getPlayer());
                 if (teamnr == 0)
@@ -139,13 +147,15 @@
         }
     }
 
-    void addTeamPoints(int team, int points)
+
+    // this function is called by the function winPoints() which adds points to the teams for every base and killed openents at a certain time
+    void TeamBaseMatch::addTeamPoints(int team, int points)
     {
-        if(player && teamnr == 0)
+        if(team == 0)
         {
             this->pointsTeam1_ += points;
         }
-        if(player && teamnr == 1)
+        if(team == 1)
         {
             this->pointsTeam2_ += points;
         }      

Modified: branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h	2009-04-27 14:26:49 UTC (rev 2934)
@@ -35,19 +35,19 @@
 #include <set>
 
 #include "TeamDeathmatch.h"
-#include "util/Timer.h"
+#include "tools/Timer.h"
 
 
 
 namespace orxonox
 {
- 
+    class TeamBaseMatchBase;
 
 
     class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch
     {
         public:
-            TeamBasematch(BaseObject* creator);
+            TeamBaseMatch(BaseObject* creator);
             
             // if class closes, close everything           
             virtual ~TeamBaseMatch() {}
@@ -59,7 +59,8 @@
             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
 
             // give information about the state of a base 
-            virtual int baseState(Base);
+            // (this should be pretty useless atm)
+//            virtual int baseState(Base);
             
 	    virtual void playerScored(PlayerInfo* player);
             virtual void showPoints();

Modified: branches/gametypes/src/orxonox/objects/worldentities/pawns/CMakeLists.txt
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	2009-04-27 14:26:49 UTC (rev 2934)
@@ -2,5 +2,6 @@
   Spectator.cc
   Pawn.cc
   SpaceShip.cc
+  TeamBaseMatchBase.cc
   Destroyer.cc
 )

Added: branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	                        (rev 0)
+++ branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	2009-04-27 14:26:49 UTC (rev 2934)
@@ -0,0 +1,51 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+
+#include "TeamBaseMatchBase.h"
+#include "core/CoreIncludes.h"
+#include "objects/gametypes/TeamBaseMatch.h"
+
+namespace orxonox
+{
+    CreateFactory(TeamBaseMatchBase);
+
+    TeamBaseMatchBase::TeamBaseMatchBase(BaseObject* creator) : Pawn(creator)
+    {
+        RegisterObject(TeamBaseMatchBase);
+
+        this->state_ = BaseState::uncontrolled;
+
+        TeamBaseMatch* gametype = dynamic_cast<TeamBaseMatch*>(this->getGametype());
+        if (gametype)
+        {
+            gametype->addBase(this);
+        }
+    }
+}
+

Modified: branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	2009-04-27 13:58:25 UTC (rev 2933)
+++ branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	2009-04-27 14:26:49 UTC (rev 2934)
@@ -38,7 +38,7 @@
 #ifndef _TeamBaseMatchBase_H__
 #define _TeamBaseMatchBase_H__
 
-#include "pawn.h"
+#include "Pawn.h"
 
 namespace orxonox
 {
@@ -54,42 +54,35 @@
         };
     }
 
-    struct Base
-    {
-        BaseState::Enum state_;
-    };
 
-
-
-
-
-
-    class _OrxonoxExport TeamBaseMatchBase : public RadarViewable
+    class _OrxonoxExport TeamBaseMatchBase : public Pawn
     {
         public:
             TeamBaseMatchBase(BaseObject* creator);
 
-	    // if class closes, close everything  
-            virtual ~TeamBaseMatchBase();
-	    
-	    virtual void setState(base)
-	    {
-		
-
+            // if class closes, close everything  
+            virtual ~TeamBaseMatchBase() {}
+	     
+	     
+	     
+            // Set the state of a base to whatever the argument of the function is 
+            void setState(BaseState::Enum state)
+            {
+                this->state_ = state;
 	    }
-	    virtual enum getState(base);
 
-    	    
 
+	    // Get the state of a base as a return value 
+	    BaseState::Enum getState()
+	    {
+	        return this->state_;
+	    }
 
 
-	protected:
+        protected:
 
-
-
-
-
- 
+            BaseState::Enum state_;
+    };
 }
 
 #endif /* _TeamBaseMatchBase_H__ */




More information about the Orxonox-commit mailing list