[Orxonox-commit 3003] r7699 - in code/branches/lastmanstanding2: data/overlays src/orxonox/gametypes

jo at orxonox.net jo at orxonox.net
Thu Dec 2 23:26:05 CET 2010


Author: jo
Date: 2010-12-02 23:26:05 +0100 (Thu, 02 Dec 2010)
New Revision: 7699

Modified:
   code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo
   code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
   code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h
Log:
Finally using the right branch - already compiling, but with memory-leak.

Modified: code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo
===================================================================
--- code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo	2010-12-02 11:56:44 UTC (rev 7698)
+++ code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo	2010-12-02 22:26:05 UTC (rev 7699)
@@ -1,5 +1,5 @@
 <Template name="LastteamstandingHUD">
-  <OverlayGroup name="DynamicmatcHUD" scale = "1, 1">
+  <OverlayGroup name="LastteamstandingHUD" scale = "1, 1">
 
 <GametypeFadingMessage
      name     = "fadingmessage"
@@ -29,7 +29,7 @@
      align     = "left"
 
      showlives     = true
-     showplayers     = false
+     showteams     = false
     />
 
     <OverlayText
@@ -39,7 +39,7 @@
      textsize  = 0.04
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "left"
-     caption   = "Players: "
+     caption   = "Teams: "
     />
 
     <LastTeamStandingInfos
@@ -51,7 +51,7 @@
      align     = "left"
 
      showlives     = false
-     showplayers     = true
+     showteams     = true
     />
 
     <OverlayText

Modified: code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc	2010-12-02 11:56:44 UTC (rev 7698)
+++ code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc	2010-12-02 22:26:05 UTC (rev 7699)
@@ -51,11 +51,12 @@
         this->bNoPunishment=false;
         this->bHardPunishment=false;
         this->punishDamageRate=0.4f;
-        this->setHUDTemplate("LastTeamStandingHUD");
+        this->setHUDTemplate("LastTeamStandingHUD");//tolowercase:-)
         this->eachTeamsPlayers = new int[teams_];
+        this->bMinPlayersReached = false;
     }
     
-    void LastTeamStanding::~LastTeamStanding()
+    LastTeamStanding::~LastTeamStanding()
     {
         delete[] this->eachTeamsPlayers;
     }   
@@ -137,7 +138,7 @@
         return min;
     }
 
-    void LastTeamStanding::end()
+    void LastTeamStanding::end()//TODO!
     {
         Gametype::end();
         
@@ -170,7 +171,7 @@
     {
         if (!player)// only for safety
             return;
-        Deathmatch::playerEntered(player);
+        TeamDeathmatch::playerEntered(player);
         if (teamsAlive<=1)
             playerLives_[player]=lives;
         else
@@ -179,7 +180,8 @@
         if(this->eachTeamsPlayers[getTeam(player)]==0)
             this->teamsAlive++;
         this->eachTeamsPlayers[getTeam(player)]++;
-        
+        if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
+            bMinPlayersReached=true;
         this->timeToAct_[player]=timeRemaining;
         this->playerDelayTime_[player]=respawnDelay;
         this->inGame_[player]=true;
@@ -187,7 +189,7 @@
 
     bool LastTeamStanding::playerLeft(PlayerInfo* player)
     {
-        bool valid_player = Deathmatch::playerLeft(player);
+        bool valid_player = TeamDeathmatch::playerLeft(player);
         if (valid_player)
         {
             this->eachTeamsPlayers[getTeam(player)]--;
@@ -254,7 +256,7 @@
         SUPER(LastTeamStanding, tick, dt);
         if(this->hasStarted()&&(!this->hasEnded()))
         {
-            if ((this->hasStarted()&&(teamsAlive<=1)))//last team remaining
+            if (bMinPlayersReached &&(this->hasStarted()&&(teamsAlive<=1)))//last team remaining
             {
                 this->end();
             }

Modified: code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h
===================================================================
--- code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h	2010-12-02 11:56:44 UTC (rev 7698)
+++ code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h	2010-12-02 22:26:05 UTC (rev 7699)
@@ -34,10 +34,12 @@
 #define _LastTeamStanding_H__
 
 #include "OrxonoxPrereqs.h"
-#include "Deathmatch.h"
+#include "TeamDeathmatch.h"
 #include <map>
 #include <vector>
 
+//TODO: Hud doesn load; problem with destructor; teams are not assigned properly; 
+
 namespace orxonox
 {
     class _OrxonoxExport LastTeamStanding : public TeamDeathmatch
@@ -62,7 +64,8 @@
             float punishDamageRate; //!< Makes Damage adjustable.
             virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
             virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
-            unsigned int * eachTeamsPlayers; //!<Each teams player's alive.
+            int * eachTeamsPlayers; //!<Each teams player's alive.
+            bool bMinPlayersReached;
 
         public:
             LastTeamStanding(BaseObject* creator); //!< Default Constructor.




More information about the Orxonox-commit mailing list