[Orxonox-commit 2880] r7583 - in code/branches/lastmanstanding: data/overlays src/orxonox/gametypes

jo at orxonox.net jo at orxonox.net
Mon Oct 25 23:11:04 CEST 2010


Author: jo
Date: 2010-10-25 23:11:04 +0200 (Mon, 25 Oct 2010)
New Revision: 7583

Modified:
   code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo
   code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
   code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
Log:
Changed inheritance. instead of Gametype it's Deathmatch.

Modified: code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo
===================================================================
--- code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo	2010-10-25 21:05:34 UTC (rev 7582)
+++ code/branches/lastmanstanding/data/overlays/dynamicmatchhud.oxo	2010-10-25 21:11:04 UTC (rev 7583)
@@ -15,7 +15,7 @@
      name     = "fadingmessage"
      position = "0.5, 0.05"
      font     = "VeraMono"
-     textsize = 0.033
+     textsize = 0.04
      colour   = "1.0, 1.0, 0.5, 1.0"
      align    = "center"
     />

Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc	2010-10-25 21:05:34 UTC (rev 7582)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc	2010-10-25 21:11:04 UTC (rev 7583)
@@ -39,7 +39,7 @@
 {
     CreateUnloadableFactory(LastManStanding);
 
-    LastManStanding::LastManStanding(BaseObject* creator) : Gametype(creator)
+    LastManStanding::LastManStanding(BaseObject* creator) : Deathmatch(creator)
     {
         RegisterObject(LastManStanding);
         this->bForceSpawn_=true;
@@ -73,7 +73,6 @@
         {
             this->timeToAct_[originator->getPlayer()]=timeRemaining;
         }
-
         return true;
     }
 
@@ -92,15 +91,6 @@
         return true;
     }
 
-    void LastManStanding::start()
-    {
-        Gametype::start();
-
-        std::string message("Try to survive!");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
-    }
-
     void LastManStanding::end()
     {
         Gametype::end();
@@ -121,14 +111,11 @@
     {
         if (!player)// only for safety
             return;
-        Gametype::playerEntered(player);
+        Deathmatch::playerEntered(player);
 
         playerLives_[player]=lives;
         this->playersAlive++;
         this->timeToAct_[player]=timeRemaining;
-        const std::string& message = player->getName() + " entered the game";
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
         //Update: EachPlayer's "Players in Game"-HUD
         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
         {
@@ -137,21 +124,15 @@
             const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive);
             this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
         }
-        
     }
 
     bool LastManStanding::playerLeft(PlayerInfo* player)
     {
-        bool valid_player = Gametype::playerLeft(player);
-
+        bool valid_player = Deathmatch::playerLeft(player);
         if (valid_player)
         {
             this->playersAlive--;
             //this->playerLives_[player].erase (player); not necessary?
-            //
-            const std::string& message = player->getName() + " left the game";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
             //Update: EachPlayer's "Players in Game"-HUD
             for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
             {
@@ -165,20 +146,6 @@
         return valid_player;
     }
 
-    bool LastManStanding::playerChangedName(PlayerInfo* player)
-    {
-        bool valid_player = Gametype::playerChangedName(player);
-
-        if (valid_player)
-        {
-            const std::string& message = player->getOldName() + " changed name to " + player->getName();
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
-        }
-
-        return valid_player;
-    }
-
     void LastManStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
     {
         if (!player)
@@ -189,7 +156,6 @@
         {
             const std::string& message = "Your Lives: " +multi_cast<std::string>(playerLives_[player]);
             this->gtinfo_->sendFadingMessage(message,it2->first->getClientID());
-
         }
     }
 
@@ -203,31 +169,8 @@
             const std::string& message1 = "Remaining Players : "+ multi_cast<std::string>(playersAlive);
             this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
         }
-    
     }
 
-    void LastManStanding::pawnKilled(Pawn* victim, Pawn* killer)
-    {
-        if (victim && victim->getPlayer())
-        {
-            std::string message;
-            if (killer)
-            {
-                if (killer->getPlayer())
-                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
-                else
-                    message = victim->getPlayer()->getName() + " was killed";
-            }
-            else
-                message = victim->getPlayer()->getName() + " died";
-
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
-        }
-
-        Gametype::pawnKilled(victim, killer);
-    }
-
     const int LastManStanding::playerGetLives(PlayerInfo* player)
     {
         if (player)

Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h	2010-10-25 21:05:34 UTC (rev 7582)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h	2010-10-25 21:11:04 UTC (rev 7583)
@@ -34,13 +34,13 @@
 #define _LastManStanding_H__
 
 #include "OrxonoxPrereqs.h"
-#include "Gametype.h"
+#include "Deathmatch.h"
 #include <map>
 #include <vector>
 
 namespace orxonox
 {
-    class _OrxonoxExport LastManStanding : public Gametype
+    class _OrxonoxExport LastManStanding : public Deathmatch
     {
     /**
     @brief
@@ -64,14 +64,11 @@
             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
 
-            virtual void start(); //!< Sends a start message.
             virtual void end(); //!< Sends an end message.
             virtual void playerEntered(PlayerInfo* player); //!< Initializes values. Manages the gametype's HUD. #Players alive via StaticMessage.
             virtual bool playerLeft(PlayerInfo* player); //!< Manages the gametype's HUD. #Players alive via StaticMessage.
-            virtual bool playerChangedName(PlayerInfo* player);
             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Manages the gametype's HUD. player's lives via FadingMessage.
             virtual void playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn);  //!< Manages the gametype's HUD. #Players alive via StaticMessage.
-            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
 
             const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
             void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".




More information about the Orxonox-commit mailing list