Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2934


Ignore:
Timestamp:
Apr 27, 2009, 4:26:49 PM (15 years ago)
Author:
vmikos
Message:

fast endversion TeamBaseMatch

Location:
code/branches/gametypes/src/orxonox
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/gamestates/GSLevel.cc

    r2826 r2934  
    4949namespace orxonox
    5050{
    51     SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l");
     51    SetCommandLineArgument(level, "teambasematchlevel.oxw").shortcut("l");
    5252
    5353    GSLevel::GSLevel()
  • code/branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt

    r2933 r2934  
    33  Deathmatch.cc
    44  TeamDeathmatch.cc
     5  TeamBaseMatch.cc
    56  Pong.cc
    67  UnderAttack.cc
  • code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc

    r2903 r2934  
    2525 
    2626
    27 #include TeamBaseMatch.h
     27#include "TeamBaseMatch.h"
    2828
    2929
    3030//implement this! not done yet!
    3131#include "objects/worldentities/pawns/TeamBaseMatchBase.h"
    32  
     32#include "core/CoreIncludes.h"
     33#include "core/XMLPort.h"
     34
    3335 
    3436namespace orxonox
     
    3840
    3941    // Timer and Creator
    40     TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathMatch(creator)
     42    TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator)
    4143    {
    4244        RegisterObject(TeamBaseMatch);
     
    5355    void TeamBaseMatch::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5456    {
     57        SUPER(TeamBaseMatch, XMLPort, xmlelement, mode);
     58
    5559//        XMLPortObject(TeamBaseMatch, WorldEntity, setNeutralshape, getNeturalshape, xmlelement, mode);
    5660//        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam1shape, getTeam1shape, xmlelement, mode);
    5761//        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam2shape, getTeam2shape, xmlelement, mode);
    5862
    59         XMLPortObject(TeamBaseMatch, TeamBaseMatchBase, addBase, getBase, xmlelement, mode);
     63//        XMLPortObject(TeamBaseMatch, TeamBaseMatchBase, addBase, getBase, xmlelement, mode);
    6064    }
    6165   
     66/*
    6267    // pretty useless at the moment...should be implemented in the TeamBaseMatchBase class headerfile
    6368    // State of the Base (controlled, uncontrolled)
     
    6873        if(Enum state_==controlTeam2) return 2;
    6974    }
    70    
     75*/ 
     76
     77
     78    // Change the control of the defeated base and respawn it with its initial health
    7179    bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator)
    7280    {
    73         set::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(victim);
    74         if (it != this->bases_.end() && victim)
     81        TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
     82        if (base)
    7583        {
    76             TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
    77             if (base)
     84            std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(base);
     85            if (it != this->bases_.end())
    7886            {
    7987                int teamnr = this->getTeam(originator->getPlayer());
     
    140148    }
    141149
    142     void addTeamPoints(int team, int points)
     150
     151    // this function is called by the function winPoints() which adds points to the teams for every base and killed openents at a certain time
     152    void TeamBaseMatch::addTeamPoints(int team, int points)
    143153    {
    144         if(player && teamnr == 0)
     154        if(team == 0)
    145155        {
    146156            this->pointsTeam1_ += points;
    147157        }
    148         if(player && teamnr == 1)
     158        if(team == 1)
    149159        {
    150160            this->pointsTeam2_ += points;
  • code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h

    r2903 r2934  
    3636
    3737#include "TeamDeathmatch.h"
    38 #include "util/Timer.h"
     38#include "tools/Timer.h"
    3939
    4040
     
    4242namespace orxonox
    4343{
    44  
     44    class TeamBaseMatchBase;
    4545
    4646
     
    4848    {
    4949        public:
    50             TeamBasematch(BaseObject* creator);
     50            TeamBaseMatch(BaseObject* creator);
    5151           
    5252            // if class closes, close everything           
     
    6060
    6161            // give information about the state of a base
    62             virtual int baseState(Base);
     62            // (this should be pretty useless atm)
     63//            virtual int baseState(Base);
    6364           
    6465            virtual void playerScored(PlayerInfo* player);
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/CMakeLists.txt

    r2933 r2934  
    33  Pawn.cc
    44  SpaceShip.cc
     5  TeamBaseMatchBase.cc
    56  Destroyer.cc
    67)
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h

    r2903 r2934  
    3939#define _TeamBaseMatchBase_H__
    4040
    41 #include "pawn.h"
     41#include "Pawn.h"
    4242
    4343namespace orxonox
     
    5555    }
    5656
    57     struct Base
    58     {
    59         BaseState::Enum state_;
    60     };
    6157
    62 
    63 
    64 
    65 
    66 
    67     class _OrxonoxExport TeamBaseMatchBase : public RadarViewable
     58    class _OrxonoxExport TeamBaseMatchBase : public Pawn
    6859    {
    6960        public:
    7061            TeamBaseMatchBase(BaseObject* creator);
    7162
    72             // if class closes, close everything 
    73             virtual ~TeamBaseMatchBase();
    74            
    75             virtual void setState(base)
    76             {
    77                
    78 
     63            // if class closes, close everything 
     64            virtual ~TeamBaseMatchBase() {}
     65             
     66             
     67             
     68            // Set the state of a base to whatever the argument of the function is
     69            void setState(BaseState::Enum state)
     70            {
     71                this->state_ = state;
    7972            }
    80             virtual enum getState(base);
    81 
    82            
    8373
    8474
    85 
    86         protected:
     75            // Get the state of a base as a return value
     76            BaseState::Enum getState()
     77            {
     78                return this->state_;
     79            }
    8780
    8881
     82        protected:
    8983
    90 
    91 
    92  
     84            BaseState::Enum state_;
     85    };
    9386}
    9487
Note: See TracChangeset for help on using the changeset viewer.