[Orxonox-commit 4914] r9583 - in code/branches/formationupdate/src/orxonox: controllers worldentities/pawns
smerkli at orxonox.net
smerkli at orxonox.net
Tue Mar 26 15:30:12 CET 2013
Author: smerkli
Date: 2013-03-26 15:30:12 +0100 (Tue, 26 Mar 2013)
New Revision: 9583
Modified:
code/branches/formationupdate/src/orxonox/controllers/FormationController.h
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
Log:
Added a check when dying to find another pawn in the
same formation
Modified: code/branches/formationupdate/src/orxonox/controllers/FormationController.h
===================================================================
--- code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-03-26 14:27:31 UTC (rev 9582)
+++ code/branches/formationupdate/src/orxonox/controllers/FormationController.h 2013-03-26 14:30:12 UTC (rev 9583)
@@ -97,6 +97,9 @@
virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+ /* Just for testing purposes: report the master. */
+ FormationController* getMaster( void ) { return myMaster_; }
+
protected:
bool formationFlight_;
bool passive_;
@@ -158,6 +161,7 @@
void setTarget(Pawn* target);
+
void searchNewTarget();
void forgetTarget();
Modified: code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-03-26 14:27:31 UTC (rev 9582)
+++ code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc 2013-03-26 14:30:12 UTC (rev 9583)
@@ -46,6 +46,8 @@
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSet.h"
+#include "controllers/FormationController.h"
+
namespace orxonox
{
CreateFactory(Pawn);
@@ -307,6 +309,24 @@
void Pawn::death()
{
+ /* TEST TEST This is used to find out if the current pawn is also
+ * the master of the formulation.
+ *
+ * NOTE: This does not yet check if the current pawn is actually
+ * the humanplayer or not!
+ */
+ for (ObjectList<FormationController>::iterator it =
+ ObjectList<FormationController>::begin();
+ it != ObjectList<FormationController>::end(); ++it )
+ {
+ orxout(user_warning) << "Test! Master: " << it->getMaster()
+ << " My controller: " << this->getPlayer()->getController() << endl;
+ }
+ /* TEST TEST */
+
+
+
+
this->setHealth(1);
if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
{
More information about the Orxonox-commit
mailing list