Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9797


Ignore:
Timestamp:
Nov 21, 2013, 3:57:23 PM (10 years ago)
Author:
jo
Message:

Added Team functionality down to the controller class.

Location:
code/trunk/src/orxonox/controllers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/controllers/Controller.cc

    r9667 r9797  
    2929#include "Controller.h"
    3030#include "core/CoreIncludes.h"
     31#include "core/XMLPort.h"
    3132#include "worldentities/ControllableEntity.h"
    3233
     
    4243        this->controllableEntity_ = 0;
    4344        this->bGodMode_ = false;
     45        this->team_=-1;
    4446    }
    4547
     
    4749    {
    4850    }
     51    void Controller::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     52    {
     53        SUPER(Controller, XMLPort, xmlelement, mode);
     54        XMLPortParam(Controller, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
     55    }
     56
    4957}
  • code/trunk/src/orxonox/controllers/Controller.h

    r9667 r9797  
    3232#include "OrxonoxPrereqs.h"
    3333#include "core/BaseObject.h"
     34#include "core/class/Super.h"
    3435
    3536namespace orxonox
     
    4445            Controller(Context* context);
    4546            virtual ~Controller();
    46 
     47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4748            inline void setPlayer(PlayerInfo* player)
    4849                { this->player_ = player; }
    4950            inline PlayerInfo* getPlayer() const
    5051                { return this->player_; }
     52            inline void setTeam(int team)
     53                { this->team_ = team; }
     54            inline int getTeam() const
     55                { return this->team_; }
    5156
    5257            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
     
    7984            PlayerInfo* player_;
    8085            ControllableEntity* controllableEntity_;
     86            int team_;
    8187        private:
    8288            bool bGodMode_;
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r9667 r9797  
    8888        this->speedCounter_ = 0.2f;
    8989        this->targetPosition_ = Vector3::ZERO;
    90         this->team_=-1;
    9190        this->target_.setCallback(createFunctor(&FormationController::targetDied, this));
    9291    }
     
    128127        SUPER(FormationController, XMLPort, xmlelement, mode);
    129128
    130         XMLPortParam(FormationController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
    131129        XMLPortParam(FormationController, "formationFlight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(false);
    132130        XMLPortParam(FormationController, "formationSize", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE);
  • code/trunk/src/orxonox/controllers/FormationController.h

    r9667 r9797  
    7676           { return this->passive_; }
    7777
    78       inline void setTeam(int team)
    79            { this->team_ = team; }
    80       inline int getTeam() const
    81            { return this->team_; }
     78
    8279
    8380      /**
     
    105102      bool formationFlight_;
    106103      bool passive_;
    107       int team_;
    108104      unsigned int maxFormationSize_;
    109105      int freedomCount_;
Note: See TracChangeset for help on using the changeset viewer.