[Orxonox-commit 4953] r9622 - in code/branches/formationupdate/src/orxonox: controllers worldentities/pawns

maxima at orxonox.net maxima at orxonox.net
Tue May 14 14:32:37 CEST 2013


Author: maxima
Date: 2013-05-14 14:32:37 +0200 (Tue, 14 May 2013)
New Revision: 9622

Modified:
   code/branches/formationupdate/src/orxonox/controllers/HumanController.cc
   code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
Log:
Just a few bug fixes.


Modified: code/branches/formationupdate/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/HumanController.cc	2013-05-07 13:58:33 UTC (rev 9621)
+++ code/branches/formationupdate/src/orxonox/controllers/HumanController.cc	2013-05-14 12:32:37 UTC (rev 9622)
@@ -101,7 +101,7 @@
         }
 
         // commandslaves when Master of a formation
-        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
+        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER && FormationController::slaves_.size() > 0)
         {
             if (HumanController::localController_s->formationMode_ != ATTACK)
                 HumanController::localController_s->commandSlaves();

Modified: code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc	2013-05-07 13:58:33 UTC (rev 9621)
+++ code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc	2013-05-14 12:32:37 UTC (rev 9622)
@@ -357,14 +357,23 @@
             		Controller* slave = this->getSlave();
             		ControllableEntity* entity = slave->getControllableEntity();
 
-            		// delete the AIController
-            		slave->setControllableEntity(0);
 
-            		// set a new master within the formation
-					orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation(orxonox_cast<FormationController*>(slave));
+            		if(!entity->hasHumanController())
+            		{
+            			// delete the AIController
+            			slave->setControllableEntity(0);
 
-					// start to control a slave
-    				this->getPlayer()->startControl(entity);
+						// set a new master within the formation
+						orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation(orxonox_cast<FormationController*>(slave));
+
+						// start to control a slave
+						this->getPlayer()->startControl(entity);
+            		}
+            		else
+                	{
+                		this->getPlayer()->stopControl();
+                	}
+
             	}
             	else
             	{




More information about the Orxonox-commit mailing list