[Orxonox-commit 4947] r9616 - in code/branches/formationupdate/src/orxonox: controllers worldentities/pawns
maxima at orxonox.net
maxima at orxonox.net
Tue Apr 23 15:47:49 CEST 2013
Author: maxima
Date: 2013-04-23 15:47:49 +0200 (Tue, 23 Apr 2013)
New Revision: 9616
Modified:
code/branches/formationupdate/src/orxonox/controllers/FormationController.h
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
Log:
A few changes of the death function. Tried to change the master of the formation.
Modified: code/branches/formationupdate/src/orxonox/controllers/FormationController.h
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-04-23 11:42:53 UTC (rev 9615)
+++ code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-04-23 13:47:49 UTC (rev 9616)
@@ -58,6 +58,7 @@
static void followme();
static void passivebehaviour(const bool passive);
static void formationsize(const int size);
+ void takeLeadOfFormation();
inline void setFormationFlight(bool formation)
{ this->formationFlight_ = formation; }
@@ -138,7 +139,6 @@
void forceFreedom();
bool forcedFree();
- void takeLeadOfFormation();
void masterAttacked(Pawn* originator);
void specificMasterActionHold();
Modified: code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-04-23 11:42:53 UTC (rev 9615)
+++ code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-04-23 13:47:49 UTC (rev 9616)
@@ -317,14 +317,10 @@
ObjectList<FormationController>::begin();
it != ObjectList<FormationController>::end(); ++it )
{
- // checks if the dying Pawn has a slave
+ // checks if the Pawn has a slave
if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
- {
- orxout(user_warning) << "This is a Slave of the HumanController: " << it->getThis() << endl;
return true;
- }
}
- orxout(user_warning) << "The HumanController has no slaves!" << endl;
return false;
}
@@ -356,17 +352,30 @@
if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
{
- /* Do different things if Pawn is the Master of a Formation
- * Doesn't work yet
- *
- */ if(this->hasSlaves())
+
+ // Do different things if Pawn is the Master of a Formation
+ if(this->hasSlaves())
{
- // start to control a slave
- this->getPlayer()->startControl(this->getSlave()->getControllableEntity());
+ Controller* slave = this->getSlave();
+ ControllableEntity* entity = slave->getControllableEntity();
+
+ // set new Master
+ orxonox_cast<FormationController*>(slave)->takeLeadOfFormation();
+
+
+ /* 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);
}
- else{
- this->getPlayer()->stopControl();
- }
+ else
+ {
+ this->getPlayer()->stopControl();
+ }
}
if (GameMode::isMaster())
{
More information about the Orxonox-commit
mailing list