[Orxonox-commit 4948] r9617 - in code/branches/formationupdate/src/orxonox: controllers worldentities/pawns
maxima at orxonox.net
maxima at orxonox.net
Tue Apr 30 15:12:11 CEST 2013
Author: maxima
Date: 2013-04-30 15:12:11 +0200 (Tue, 30 Apr 2013)
New Revision: 9617
Modified:
code/branches/formationupdate/src/orxonox/controllers/Controller.h
code/branches/formationupdate/src/orxonox/controllers/FormationController.h
code/branches/formationupdate/src/orxonox/controllers/HumanController.h
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
Log:
The AIController of the new HumanController is deleted.
Modified: code/branches/formationupdate/src/orxonox/controllers/Controller.h
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/Controller.h 2013-04-23 13:47:49 UTC (rev 9616)
+++ code/branches/formationupdate/src/orxonox/controllers/Controller.h 2013-04-30 13:12:11 UTC (rev 9617)
@@ -64,7 +64,6 @@
{ return this->controllableEntity_; }
virtual void changedControllableEntity() {}
- protected:
// don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
inline void setControllableEntity(ControllableEntity* entity)
{
Modified: code/branches/formationupdate/src/orxonox/controllers/FormationController.h
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-04-23 13:47:49 UTC (rev 9616)
+++ code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-04-30 13:12:11 UTC (rev 9617)
@@ -59,6 +59,7 @@
static void passivebehaviour(const bool passive);
static void formationsize(const int size);
void takeLeadOfFormation();
+ void loseMasterState();
inline void setFormationFlight(bool formation)
{ this->formationFlight_ = formation; }
@@ -135,7 +136,6 @@
void freeSlaves();
void forceFreeSlaves();
- void loseMasterState();
void forceFreedom();
bool forcedFree();
Modified: code/branches/formationupdate/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/HumanController.h 2013-04-23 13:47:49 UTC (rev 9616)
+++ code/branches/formationupdate/src/orxonox/controllers/HumanController.h 2013-04-30 13:12:11 UTC (rev 9617)
@@ -101,9 +101,9 @@
static Pawn* getLocalControllerEntityAsPawn();
//friend class, for mouselook
friend class Map;
+ static HumanController* localController_s;
protected:
- static HumanController* localController_s;
bool controlPaused_;
private:
Modified: code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-04-23 13:47:49 UTC (rev 9616)
+++ code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-04-30 13:12:11 UTC (rev 9617)
@@ -313,7 +313,7 @@
*/
bool Pawn::hasSlaves()
{
- for (ObjectList<FormationController>::iterator it =
+ for (ObjectList<FormationController>::iterator it =
ObjectList<FormationController>::begin();
it != ObjectList<FormationController>::end(); ++it )
{
@@ -326,8 +326,8 @@
Controller* Pawn::getSlave(){
for (ObjectList<FormationController>::iterator it =
- ObjectList<FormationController>::begin();
- it != ObjectList<FormationController>::end(); ++it )
+ ObjectList<FormationController>::begin();
+ it != ObjectList<FormationController>::end(); ++it )
{
if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
return it->getThis();
@@ -359,18 +359,25 @@
Controller* slave = this->getSlave();
ControllableEntity* entity = slave->getControllableEntity();
+ // delete the AIController
+ slave->setControllableEntity(0);
+
+
// set new Master
- orxonox_cast<FormationController*>(slave)->takeLeadOfFormation();
+ orxonox_cast<FormationController*>(this->getController())->loseMasterState();
+
/* TO DO: - new Master is not set right
* - The slave still has a AIController
*
*/
- //slave->getPlayer()->stopControl();
// start to control a slave
this->getPlayer()->startControl(entity);
+
+ //orxonox_cast<FormationController*>(this->getController())->takeLeadOfFormation();
+
}
else
{
More information about the Orxonox-commit
mailing list