[Orxonox-commit 6101] r10759 - in code/branches/AI_HS15: data/levels src/orxonox/controllers
gania at orxonox.net
gania at orxonox.net
Mon Nov 2 16:48:27 CET 2015
Author: gania
Date: 2015-11-02 16:48:27 +0100 (Mon, 02 Nov 2015)
New Revision: 10759
Modified:
code/branches/AI_HS15/data/levels/AITest.oxw
code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
code/branches/AI_HS15/src/orxonox/controllers/FleetController.h
code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
Log:
small fixes
Modified: code/branches/AI_HS15/data/levels/AITest.oxw
===================================================================
--- code/branches/AI_HS15/data/levels/AITest.oxw 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/data/levels/AITest.oxw 2015-11-02 15:48:27 UTC (rev 10759)
@@ -61,7 +61,117 @@
</SpaceShip>
<?lua end ?>
</!-->
+ <SpaceShip position="0,-10000,0" direction="0,-1,0" >
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <FleetController team=1>
+ </FleetController>
+ </controller>
+ </SpaceShip>
+ <?lua
+ for i = 0, 0, 1 do
+ ?>
+
+ <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -1000 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <DivisionController team=1 formationMode="DIAMOND">
+ </DivisionController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -1600 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=1>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -2200 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=1>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -2800 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <SectionController team=1>
+ </SectionController>
+ </controller>
+ </SpaceShip>
+ <?lua end ?>
+ <!-- <SpaceShip position="4000, 1500, -1300 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=2>
+ </WingmanController>
+ </controller>
+ </SpaceShip> -->
+<!--
+ <?lua
+ for i = 0, 0, 1 do
+ ?>
+
+ <StaticEntity position="1000,-10000,0" direction="0,-1,0" >
+ <controller>
+ <FleetController team=2>
+ </FleetController>
+ </controller>
+ </StaticEntity>
+ <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -1000 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <DivisionController team=2>
+ </DivisionController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -1600 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=2>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -2200 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=2>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -2800 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <SectionController team=2>
+ </SectionController>
+ </controller>
+ </SpaceShip>
+ <?lua end ?> -->
+
+<!--
+
<StaticEntity position = "-1000, -1000, -1000">
<controller>
@@ -107,6 +217,52 @@
</controller>
</SpaceShip>
+
+ <StaticEntity position = "-1000, -1000, -2000">
+
+ <controller>
+ <FleetController accuracy=10 team=2 >
+ </FleetController>
+ </controller>
+ </StaticEntity>
+
+ <SpaceShip position="4000, 1000, -1300 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <DivisionController team=2>
+ </DivisionController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="4000, 1500, -1300 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=2>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="4000, 1500, -1700 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WingmanController team=2>
+ </WingmanController>
+ </controller>
+ </SpaceShip>
+ <SpaceShip position="4000, 1000, -1900 ?>" lookat="0,0,0">
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <SectionController team=2>
+ </SectionController>
+ </controller>
+ </SpaceShip> -->
+
<!-->
<?lua
Modified: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc 2015-11-02 15:48:27 UTC (rev 10759)
@@ -26,25 +26,26 @@
*
*/
#include "controllers/CommonController.h"
-/*
+#include "core/XMLPort.h"
+
#include "weaponsystem/WeaponMode.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponSlot.h"
#include "weaponsystem/WeaponSlot.h"
#include "worldentities/pawns/SpaceShip.h"
-*/
+
namespace orxonox
{
RegisterClass(CommonController);
- static const float SPEED = 0.6f;
- static const float ROTATEFACTOR = 0.2f;
+ float SPEED = 0.7f;
+ float ROTATEFACTOR = 0.3f;
CommonController::CommonController(Context* context) : Controller(context)
{
- //this->bSetupWorked = false;
+ this->bSetupWorked = false;
RegisterObject(CommonController);
}
@@ -54,8 +55,59 @@
{
}
+ void CommonController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(CommonController, XMLPort, xmlelement, mode);
+ XMLPortParam(CommonController, "formationMode", setFormationModeXML, getFormationModeXML, xmlelement, mode);
+ }
+ void CommonController::setFormationModeXML(std::string val)
+ {
+ const std::string valUpper = getUppercase(val);
+ FormationMode::Value value;
+ if (valUpper == "VEE")
+ value = FormationMode::VEE;
+ else if (valUpper == "WALL")
+ value = FormationMode::WALL;
+ else if (valUpper == "FINGER4")
+ value = FormationMode::FINGER4;
+ else if (valUpper == "DIAMOND")
+ value = FormationMode::DIAMOND;
+ else
+ ThrowException(ParseError, std::string("Attempting to set an unknown FormationMode: '") + val + "'.");
+ this->setFormationMode(value);
+
+ }
+ std::string CommonController::getFormationModeXML()
+ {
+ switch (this->formationMode_)
+ {
+ case FormationMode::VEE:
+ {
+ return "VEE";
+ break;
+ }
+ case FormationMode::WALL:
+ {
+ return "WALL";
+ break;
+ }
+ case FormationMode::FINGER4:
+ {
+ return "FINGER4";
+ break;
+ }
+ case FormationMode::DIAMOND:
+ {
+ return "DIAMOND";
+ break;
+ }
+ default:
+ return "DIAMOND";
+ break;
+ }
+ }
bool CommonController::setWingman (CommonController* wingman)
{
@@ -66,10 +118,16 @@
{
return true;
}
+ void CommonController::setTarget(ControllableEntity* target)
+ {
+ this->target_ = target;
+ orxout (internal_error) << " TARGET SET " << endl;
+ if (target)
+ this->targetPosition_ = target->getPosition();
+ }
-
void CommonController::setTargetPosition(const Vector3& target)
{
this->targetPosition_ = target;
@@ -112,7 +170,7 @@
float diff=orient.getRoll(false).valueRadians()-(this->getControllableEntity()->getOrientation().getRoll(false).valueRadians());
while(diff>math::twoPi) diff-=math::twoPi;
while(diff<-math::twoPi) diff+=math::twoPi;
- this->getControllableEntity()->rotateRoll(-diff);
+ this->getControllableEntity()->rotateRoll(diff*ROTATEFACTOR);
}
void CommonController::copyTargetOrientation()
{
@@ -133,10 +191,14 @@
{
if (!this->getControllableEntity())
return;
+ if (this->rank_ == Rank::DIVISIONLEADER)
+ SPEED *= 0.8;
+ if (this->rank_ == Rank::SECTIONLEADER)
+ SPEED *= 0.9;
//100 is (so far) the smallest tolerance (empirically found) that can be reached,
//with smaller distance spaceships can't reach position and go circles around it instead
- int tolerance = 100;
+ int tolerance = 60;
ControllableEntity* entity = this->getControllableEntity();
Vector2 coord = get2DViewCoordinates
@@ -159,7 +221,7 @@
this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR * rotateY);
//300 works, maybe less is better
- if (distance < 300)
+ if (distance < 400)
{
//Change roll when close. When Spaceship faces target, roll doesn't affect it's trajectory
//It's important that roll is not changed in the process of changing yaw and pitch
@@ -179,7 +241,7 @@
}
}
-/*
+
int CommonController::getFiremode(std::string name)
{
for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
@@ -226,15 +288,12 @@
}
void CommonController::doFire()
{
- if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ...
+ if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ...
{
this->setupWeapons();
}
- else if(this->getControllableEntity() &&
- weaponModes_.size()&&
- this->bShooting_ &&
- this->isCloseAtTarget((3)*1000) &&
- this->isLookingAtTarget(math::pi / 20.0f))
+ else if(this->getControllableEntity() && weaponModes_.size()&&this->bShooting_ &&
+ this->isCloseAtTarget((1 + 2)*1000) && this->isLookingAtTarget(math::pi / 20.0f))
{
int firemode;
float random = rnd(1);//
@@ -245,6 +304,7 @@
else if ((firemode = getFiremode("HsW01")) > -1 ) //LASER: default weapon
this->getControllableEntity()->fire(firemode);
+
}
}
bool CommonController::isLookingAtTarget(float angle) const
@@ -268,7 +328,7 @@
Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
if (pawn)
pawn->setAimPosition(aimPosition);
- }*/
+ }
Modified: code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.h 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.h 2015-11-02 15:48:27 UTC (rev 10759)
@@ -32,11 +32,28 @@
#include "controllers/Controller.h"
#include "worldentities/ControllableEntity.h"
-/*#include "worldentities/pawns/Pawn.h"
-*/
+#include "worldentities/pawns/Pawn.h"
+
namespace orxonox
{
+
+ namespace FormationMode
+ {
+ enum Value
+ {
+ VEE, FINGER4, DIAMOND, WALL
+ };
+ }
+ namespace Rank
+ {
+ enum Value
+ {
+ NONE, SECTIONLEADER, DIVISIONLEADER, WINGMAN
+ };
+
+ }
+
class _OrxonoxExport CommonController : public Controller
{
public:
@@ -49,24 +66,28 @@
- enum FormationMode { VEE, FINGER4, DIAMOND, WALL };
- virtual void setFormationMode(FormationMode val)
+
+
+ virtual void setFormationMode(FormationMode::Value val)
{ this->formationMode_ = val; }
- inline FormationMode getFormationMode() const
+ inline FormationMode::Value getFormationMode() const
{ return this->formationMode_; }
+ virtual void setFormationModeXML(std::string val);
+ virtual std::string getFormationModeXML();
- enum Rank { NONE, SECTIONLEADER, DIVISIONLEADER, WINGMAN };
- virtual void setRank(Rank val)
+ virtual void setRank(Rank::Value val)
{ this->rank_ = val; }
- inline Rank getRank() const
+ inline Rank::Value getRank() const
{ return this->rank_; }
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual bool setWingman(CommonController* wingman);
virtual bool hasWingman();
+ void setTarget(ControllableEntity* target);
void setTargetOrientation(const Quaternion& orient);
void setTargetOrientation(ControllableEntity* target);
@@ -86,7 +107,7 @@
void copyOrientation(const Quaternion& orient);
void copyTargetOrientation();
- /* bool isCloseAtTarget(float distance) const;
+ bool isCloseAtTarget(float distance) const;
void doFire();
void aimAtTarget();
bool isLookingAtTarget(float angle) const;
@@ -98,8 +119,8 @@
void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
bool bSetupWorked; //<! If false, setupWeapons() is called.
int getFiremode(std::string name);
-*/
+
bool bHasTargetPosition_;
Vector3 targetPosition_;
bool bHasTargetOrientation_;
@@ -110,8 +131,8 @@
bool bShooting_;
- FormationMode formationMode_;
- Rank rank_;
+ FormationMode::Value formationMode_;
+ Rank::Value rank_;
Modified: code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc 2015-11-02 15:48:27 UTC (rev 10759)
@@ -37,14 +37,15 @@
DivisionController::DivisionController(Context* context) : LeaderController(context)
{
RegisterObject(DivisionController);
- this->setFormationMode(WALL);
+
+ this->setFormationMode(FormationMode::DIAMOND);
this->myFollower_ = 0;
this->myWingman_ = 0;
this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this)));
- this->rank_ = DIVISIONLEADER;
+ this->rank_ = Rank::DIVISIONLEADER;
- Vector3* pos = new Vector3(500,500,-500);
+ Vector3* pos = new Vector3(-4000,-1000,-2000);
this->setTargetPosition(*pos);
}
@@ -57,12 +58,12 @@
void DivisionController::tick(float dt)
{
- if (this->target_)
+ /*if (this->target_)
{
- //this->aimAtTarget();
- //this->doFire();
- //this->bShooting_ = true;
- }
+ this->aimAtTarget();
+ this->doFire();
+ this->bShooting_ = true;
+ }*/
if (this->bHasTargetPosition_)
{
@@ -76,17 +77,23 @@
{
setTargetPositionOfFollower();
setTargetPositionOfWingman();
-/*
+
+
+ if (this->myFollower_ && this->target_)
+ this->myFollower_->setTarget(this->target_);
+ if (this->target_ && this->myWingman_)
+ this->myWingman_->setTarget(this->target_);
+ /*
for (ObjectList<Controller>::iterator it = ObjectList<Controller>::begin(); it; ++it)
{
- if (this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam())
+ if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()) && (it)->getControllableEntity()->getTeam() != 0)
{
- this->target_=it->getControllableEntity();
- this->setTargetPosition(this->target_->getWorldPosition());
+ this->setTargetPosition(it->getControllableEntity()->getWorldPosition());
+
break;
}
- }*/
-
+ }
+ */
}
@@ -98,21 +105,23 @@
return;
Vector3* targetRelativePositionOfWingman;
switch (this->formationMode_){
- case WALL:
+ case FormationMode::WALL:
{
targetRelativePositionOfWingman = new Vector3 (400, 0, 0);
break;
}
- case FINGER4:
+ case FormationMode::FINGER4:
{
+ targetRelativePositionOfWingman = new Vector3 (400, 0, -200);
break;
}
- case VEE:
+ case FormationMode::VEE:
{
break;
}
- case DIAMOND:
+ case FormationMode::DIAMOND:
{
+ targetRelativePositionOfWingman = new Vector3 (400, 0, -200);
break;
}
}
@@ -129,23 +138,27 @@
{
if (!this->myFollower_)
return;
+ this->myFollower_->setFormationMode(this->formationMode_);
+
Vector3* targetRelativePositionOfFollower;
switch (this->formationMode_){
- case WALL:
+ case FormationMode::WALL:
{
targetRelativePositionOfFollower = new Vector3 (-400, 0, 0);
break;
}
- case FINGER4:
+ case FormationMode::FINGER4:
{
+ targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);
break;
}
- case VEE:
+ case FormationMode::VEE:
{
break;
}
- case DIAMOND:
+ case FormationMode::DIAMOND:
{
+ targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);
break;
}
}
Modified: code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc 2015-11-02 15:48:27 UTC (rev 10759)
@@ -43,7 +43,7 @@
/* this->goalTarget_ = NULL;
this->goalProtect_ = NULL;*/
- //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&FleetController::action, this)));
+ this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&FleetController::action, this)));
}
FleetController::~FleetController()
@@ -55,8 +55,26 @@
}
void FleetController::action()
{
+ this->divisions_.clear();
+
+ /*for (ObjectList<DivisionController>::iterator it = ObjectList<DivisionController>::begin(); it; ++it)
+ {
+ if ((this->getControllableEntity()->getTeam() == (it)->getControllableEntity()->getTeam()))
+ {
+ this->divisions_.push_back(*(it));
+ }
+ }
+ for (ObjectList<Controller>::iterator it = ObjectList<Controller>::begin(); it; ++it)
+ {
+ if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()) && (it)->getControllableEntity()->getTeam() != 0)
+ {
+ for(std::vector<WeakPtr<DivisionController> >::iterator it2 = divisions_.begin(); it2 != divisions_.end(); ++it2) {
+ (*it2)->setTarget(it->getControllableEntity());
+ }
+ break;
+ }
+ }*/
-
}
void FleetController::tick(float dt)
{
Modified: code/branches/AI_HS15/src/orxonox/controllers/FleetController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/FleetController.h 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/FleetController.h 2015-11-02 15:48:27 UTC (rev 10759)
@@ -55,6 +55,8 @@
class _OrxonoxExport FleetController : public Controller, public Tickable
{
public:
+ static const float ACTION_INTERVAL = 1.0f;
+
FleetController(Context* context);
virtual ~FleetController();
@@ -73,6 +75,7 @@
protected:
+ virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
GameGoal gameGoal_;
@@ -80,11 +83,10 @@
WeakPtr<Pawn> goalTarget_;
WeakPtr<Pawn> goalProtect_;
- virtual void action();
private:
std::vector<WeakPtr<DivisionController> > divisions_;
- //Timer actionTimer_; //<! Regularly calls action().
+ Timer actionTimer_; //<! Regularly calls action().
};
}
Modified: code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc 2015-11-02 15:48:27 UTC (rev 10759)
@@ -36,12 +36,12 @@
SectionController::SectionController(Context* context) : LeaderController(context)
{
RegisterObject(SectionController);
- this->setFormationMode(WALL);
+ this->setFormationMode(FormationMode::FINGER4);
this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&SectionController::action, this)));
this->myWingman_ = 0;
this->myDivisionLeader_ = 0;
- this->rank_ = SECTIONLEADER;
+ this->rank_ = Rank::SECTIONLEADER;
orxout(internal_error) << this << "Was created" << endl;
@@ -57,6 +57,12 @@
if (!this->isActive())
return;
+ /*if (this->target_)
+ {
+ this->aimAtTarget();
+ this->doFire();
+ this->bShooting_ = true;
+ }*/
if (this->bHasTargetPosition_)
{
this->moveToTargetPosition();
@@ -75,9 +81,16 @@
this->myDivisionLeader_ = newDivisionLeader;
if (newDivisionLeader)
orxout(internal_error) << "new DivisionLeader set" << endl;
+ else
+ {
+
+ }
}
setTargetPositionOfWingman();
+ if (this->target_ && this->myWingman_)
+ this->myWingman_->setTarget(this->target_);
+
}
@@ -87,21 +100,23 @@
return;
Vector3* targetRelativePositionOfWingman;
switch (this->formationMode_){
- case WALL:
+ case FormationMode::WALL:
{
targetRelativePositionOfWingman = new Vector3 (-400, 0, 0);
break;
}
- case FINGER4:
+ case FormationMode::FINGER4:
{
+ targetRelativePositionOfWingman = new Vector3 (-400, 0, -200);
break;
}
- case VEE:
+ case FormationMode::VEE:
{
break;
}
- case DIAMOND:
+ case FormationMode::DIAMOND:
{
+ targetRelativePositionOfWingman = new Vector3 (400, -200, 0);
break;
}
}
@@ -126,7 +141,7 @@
for (ObjectList<LeaderController>::iterator it = ObjectList<LeaderController>::begin(); it; ++it)
{
//0ptr or not DivisionController?
- if (!(it) || !((it)->getRank() == DIVISIONLEADER) || !(it->getControllableEntity()))
+ if (!(it) || !((it)->getRank() == Rank::DIVISIONLEADER) || !(it->getControllableEntity()))
continue;
//same team?
if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
Modified: code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc 2015-11-02 15:33:32 UTC (rev 10758)
+++ code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc 2015-11-02 15:48:27 UTC (rev 10759)
@@ -40,7 +40,7 @@
RegisterObject(WingmanController);
this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));
this->myLeader_ = 0;
- this->rank_ = WINGMAN;
+ this->rank_ = Rank::WINGMAN;
}
@@ -52,7 +52,12 @@
void WingmanController::tick(float dt)
{
//-------------------------------------------------------
-
+ /* if (this->target_)
+ {
+ this->aimAtTarget();
+ this->doFire();
+ this->bShooting_ = true;
+ }*/
if (!this->isActive())
return;
@@ -87,7 +92,10 @@
if (newLeader)
orxout(internal_error) << "new Leader set" << endl;
else
- orxout(internal_error) << "0 leader" << endl;
+ {
+ //orxout(internal_error) << "0 leader" << endl;
+
+ }
}
else
@@ -112,7 +120,7 @@
{
//0ptr?
if (!it ||
- (it->getRank() != SECTIONLEADER && it->getRank() != DIVISIONLEADER) ||
+ (it->getRank() != Rank::SECTIONLEADER && it->getRank() != Rank::DIVISIONLEADER) ||
!(it->getControllableEntity()))
continue;
//same team?
More information about the Orxonox-commit
mailing list