Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

fast endversion TeamBaseMatch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.