[Orxonox-commit 5132] r9797 - code/trunk/src/orxonox/controllers
jo at orxonox.net
jo at orxonox.net
Thu Nov 21 15:57:23 CET 2013
Author: jo
Date: 2013-11-21 15:57:23 +0100 (Thu, 21 Nov 2013)
New Revision: 9797
Modified:
code/trunk/src/orxonox/controllers/Controller.cc
code/trunk/src/orxonox/controllers/Controller.h
code/trunk/src/orxonox/controllers/FormationController.cc
code/trunk/src/orxonox/controllers/FormationController.h
Log:
Added Team functionality down to the controller class.
Modified: code/trunk/src/orxonox/controllers/Controller.cc
===================================================================
--- code/trunk/src/orxonox/controllers/Controller.cc 2013-11-21 13:27:39 UTC (rev 9796)
+++ code/trunk/src/orxonox/controllers/Controller.cc 2013-11-21 14:57:23 UTC (rev 9797)
@@ -28,6 +28,7 @@
#include "Controller.h"
#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
#include "worldentities/ControllableEntity.h"
namespace orxonox
@@ -41,9 +42,16 @@
this->player_ = 0;
this->controllableEntity_ = 0;
this->bGodMode_ = false;
+ this->team_=-1;
}
Controller::~Controller()
{
}
+ void Controller::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Controller, XMLPort, xmlelement, mode);
+ XMLPortParam(Controller, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
+ }
+
}
Modified: code/trunk/src/orxonox/controllers/Controller.h
===================================================================
--- code/trunk/src/orxonox/controllers/Controller.h 2013-11-21 13:27:39 UTC (rev 9796)
+++ code/trunk/src/orxonox/controllers/Controller.h 2013-11-21 14:57:23 UTC (rev 9797)
@@ -31,6 +31,7 @@
#include "OrxonoxPrereqs.h"
#include "core/BaseObject.h"
+#include "core/class/Super.h"
namespace orxonox
{
@@ -43,11 +44,15 @@
public:
Controller(Context* context);
virtual ~Controller();
-
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setPlayer(PlayerInfo* player)
{ this->player_ = player; }
inline PlayerInfo* getPlayer() const
{ return this->player_; }
+ inline void setTeam(int team)
+ { this->team_ = team; }
+ inline int getTeam() const
+ { return this->team_; }
virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
@@ -78,6 +83,7 @@
protected:
PlayerInfo* player_;
ControllableEntity* controllableEntity_;
+ int team_;
private:
bool bGodMode_;
};
Modified: code/trunk/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.cc 2013-11-21 13:27:39 UTC (rev 9796)
+++ code/trunk/src/orxonox/controllers/FormationController.cc 2013-11-21 14:57:23 UTC (rev 9797)
@@ -87,7 +87,6 @@
this->bHasTargetOrientation_=false;
this->speedCounter_ = 0.2f;
this->targetPosition_ = Vector3::ZERO;
- this->team_=-1;
this->target_.setCallback(createFunctor(&FormationController::targetDied, this));
}
@@ -127,7 +126,6 @@
{
SUPER(FormationController, XMLPort, xmlelement, mode);
- XMLPortParam(FormationController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
XMLPortParam(FormationController, "formationFlight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(false);
XMLPortParam(FormationController, "formationSize", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE);
XMLPortParam(FormationController, "passive", setPassive, getPassive, xmlelement, mode).defaultValues(false);
Modified: code/trunk/src/orxonox/controllers/FormationController.h
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.h 2013-11-21 13:27:39 UTC (rev 9796)
+++ code/trunk/src/orxonox/controllers/FormationController.h 2013-11-21 14:57:23 UTC (rev 9797)
@@ -75,11 +75,8 @@
inline bool getPassive() const
{ return this->passive_; }
- inline void setTeam(int team)
- { this->team_ = team; }
- inline int getTeam() const
- { return this->team_; }
+
/**
@brief Mode of the formation, behaviour of slaves
Normal-normal behaviour
@@ -104,7 +101,6 @@
protected:
bool formationFlight_;
bool passive_;
- int team_;
unsigned int maxFormationSize_;
int freedomCount_;
enum State {SLAVE, MASTER, FREE};
More information about the Orxonox-commit
mailing list